很棒的WM,恶性BTC小部件不会更新文本框

发布于 01-18 04:50 字数 1170 浏览 5 评论 0原文

我正在尝试创建一个显示当前BTC价格的小部件,但显示的小部件未更新。

首先,我用我更改了BTC小部件代码并注册小部件

mytextwidget = {     
  widget = wibox.widget.textbox, 
}
btcbox = {     
  {
    mytextwidget,
    halign = "center",
    layout = wibox.container.place,
  },
  forced_width = 100,
  layout = wibox.layout.stack, 
}
vicious.register(mytextwidget,vicious.contrib.btc,"$1",2,"eur")

,以使返回表的索引是数字而不是字符串“ {Price}”,因为我无法以这种方式注册(也许有人可以告诉我如何更改格式字符串以使其有效)。然后,我将其添加到默认的wibox中,

s.mywibox:setup {
  layout = wibox.layout.align.horizontal,
  { -- Left widgets
    layout = wibox.layout.fixed.horizontal,
    mylauncher,
    s.mytaglist,
    s.mypromptbox,     
  },
  s.mytasklist,
  -- Middle widget
  { -- Right widgets
    layout = wibox.layout.fixed.horizontal,
    mykeyboardlayout,
    wibox.widget.systray(),
    mytextclock,
    batbox,
    btcbox,
    s.mylayoutbox,  
  }
}

因为您还可以看到,还有以相同方式设置的batbox,除了注册到vicious.widget.bat widget,而且此操作正常。我是Awesomewm,尤其是LUA的新手,但我试图通过恶性库进行反向工程师,而小部件的文字实际上得到了更新。我创建了一个顽皮的通知,该通知

widget.text = fmtd_data

在vicial库的init.lua之后立即称为“显示小部件文本”,实际上正在显示正确的结果。希望有人可以向我解释为什么不显示这种变化,谢谢!

I am trying to create a widget which displays the current BTC price, but the displayed widget is not updated.

First i create and register the widget with

mytextwidget = {     
  widget = wibox.widget.textbox, 
}
btcbox = {     
  {
    mytextwidget,
    halign = "center",
    layout = wibox.container.place,
  },
  forced_width = 100,
  layout = wibox.layout.stack, 
}
vicious.register(mytextwidget,vicious.contrib.btc,"$1",2,"eur")

I changed the btc widgets code, such that the indices of the returned table are numeric instead of the string "{price}", because i was not able to register it that way(maybe someone can tell me how to change the format string so that it works). I then add it to the default wibox with

s.mywibox:setup {
  layout = wibox.layout.align.horizontal,
  { -- Left widgets
    layout = wibox.layout.fixed.horizontal,
    mylauncher,
    s.mytaglist,
    s.mypromptbox,     
  },
  s.mytasklist,
  -- Middle widget
  { -- Right widgets
    layout = wibox.layout.fixed.horizontal,
    mykeyboardlayout,
    wibox.widget.systray(),
    mytextclock,
    batbox,
    btcbox,
    s.mylayoutbox,  
  }
}

As you can see there is also the batbox, which is setup the same way, except for registering to the vicious.widget.bat widget and this one works fine. I am new to awesomewm and especially Lua but i tried to reverse engineer through the vicious library and the text of the widget actually gets updated. I created a naughty notification which is called right after

widget.text = fmtd_data

in the init.lua of the vicious library, to display the widgets text and it is actually showing the correct result. Hopefully someone can explain it to me why this change is not displayed, thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

思念满溢2025-01-25 04:50:20

随机猜测没有太多时间来尝试的时间:

mytextwidget = {     
  widget = wibox.widget.textbox, 
}

用上面的建议替换为

mytextwidget = wibox.widget.textbox()

为什么要建议这样做? Well, it's what is done on https://vicious.readthedocs.io /en/latest/examples.html#date-widget

Random guess without much time to try things out:

mytextwidget = {     
  widget = wibox.widget.textbox, 
}

replace the above with

mytextwidget = wibox.widget.textbox()

Why am I suggesting this? Well, it's what is done on https://vicious.readthedocs.io/en/latest/examples.html#date-widget.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文