Skip to content
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 issue when 2 widgets #61

Closed
stobenski opened this issue Sep 16, 2014 · 2 comments
Closed

net issue when 2 widgets #61

stobenski opened this issue Sep 16, 2014 · 2 comments
Labels

Comments

@stobenski
Copy link

When we have 2 net widgets at same time (one for download speed and one for upload):

    net_widgetdl = lain.widgets.net({
        settings = function()
            widget:set_markup(markup.font("Tamsyn 1", " ") .. net_now.received .. space2)
        end
    })

    widget_netdl = wibox.widget.imagebox()
    widget_netdl:set_image(beautiful.widget_netdl)
    netwidgetdl = wibox.widget.background()
    netwidgetdl:set_widget(net_widgetdl)
    netwidgetdl:set_bgimage(beautiful.widget_display)
    net_widgetul = lain.widgets.net({
        settings = function()
            widget:set_markup(markup.font("Tamsyn 1", " ") .. net_now.sent .. space2)
        end
    })

    widget_netul = wibox.widget.imagebox()
    widget_netul:set_image(beautiful.widget_netul)
    netwidgetul = wibox.widget.background()
    netwidgetul:set_widget(net_widgetul)
    netwidgetul:set_bgimage(beautiful.widget_display)

there is strange issue, download speed freeze from start at 294754.4 or 6574.0 and such, also upload speed not displayin real speed.

When 1 net widget (with: .. net_now.received .. " - " .. net_now.sent .. ) - everything ok.

How to make it work when 2 net widgets at same time?

@stobenski
Copy link
Author

I think 2 instances of net widget can't work at same time (same issue with vicious widget), but like workaround we can duplicate lain/widgets/net.lua as lain/widgets/net2.lua and do this trick:

    net_widgetdl = lain.widgets.net({
        settings = function()
            widget:set_markup(markup.font("Tamsyn 1", " ") .. net_now.received .. space2)
        end
    })
    net_widgetul = lain.widgets.net2({
        settings = function()
            widget:set_markup(markup.font("Tamsyn 1", " ") .. net_now.sent .. space2)
        end
    })

and everything works!

@lcpz
Copy link
Owner

lcpz commented Sep 16, 2014

Two net widgets are highly inefficient, you can use just one for your purpose: the widget inner function is in the main scope, so you can update any textbox in your rc.lua from it. Here follows a snippet.

netdowninfo = wibox.widget.textbox()
netupinfo = lain.widgets.net({
    settings = function()
        widget:set_markup(markup("#e54c62", net_now.sent .. " "))
        netdowninfo:set_markup(markup("#87af5f", net_now.received .. " "))
    end
})

This is already achieved in copycats multicolor and powerarrow-darker.

The same technique should work with vicious as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants