-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Net widget causes random crashes #464
Comments
same problem, Is there a way to solve this? |
I was fighting this since yesterday when I started using this widget. The intermittent nature of the error really makes it difficult to debug. I tried many things to isolate it, but haven't found how to solve this in the lain code. However, I did find a workaround:
Here's my use case which is adapted from copycats: -- Net
local netdownicon = wibox.widget.imagebox(beautiful.widget_netdown)
local netdowninfo = wibox.widget.textbox()
local netupicon = wibox.widget.imagebox(beautiful.widget_netup)
local netupinfo = wibox.widget.textbox()
-- NOTE: actually using this widget in the wibar doesn't work reliably!
-- as shown on the lain wiki it will error on awesome reload intermittently!
-- this is caused by it trying to set 'devices' when the widget is "read only" ???
-- My solution is to use separate textbox widgets for display in wibar.
local netinfo = lain.widget.net({
settings = function()
netupinfo:set_markup(markup.fontfg(beautiful.font, "#e54c62", net_now.sent .. " "))
netdowninfo:set_markup(markup.fontfg(beautiful.font, "#87af5f", net_now.received .. " "))
end
})
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- in the s.mywibox:setup right widgets block:
netdownicon,
netdowninfo,
netupicon,
netupinfo,
|
I might have found the problem, and I believe the underlying reason is because the net widget is implemented by using a generic table. -- ...
local function factory(args)
args = args or {}
-- The line below is the line that causes all the problems
local net = { widget = args.widget or wibox.widget.textbox(), devices = {} }
local timeout = args.timeout or 2
local units = args.units or 1024 -- KB
local notify = args.notify or "on"
local wifi_state = args.wifi_state or "off"
local eth_state = args.eth_state or "off"
-- ...
return net
end From: https://github.com/lcpz/lain/blob/master/widget/net.lua#L20 The solution would be to actually use the wibox.widget.base.make_widget function that awesome provides. The reason why I believe the generic table method breaks, because of how awesomewm parses widget layouts. After some digging in the awesomewm source code I couldn't really figure out exactly "why" it crashes. But I am really confident that after refactor the widget to use |
Thank you, this method works just fine for me, the intermittent error is gone. |
Hi! I want to use the net widget, here's my code:
And I have my wibox setup:
(Those
mysep
are just textboxes with spaces). When I restart awesome (including when I turn on the pc) sometimes I get an error. If I restart again the error is solved. After deactivating and activating all the widgets I conclude that isnet
the cause of the problem. There's some issue with my config file? Thanks!The text was updated successfully, but these errors were encountered: