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

mem used frozen, swapused jumping #85

Closed
qubodup opened this issue Jan 1, 2015 · 2 comments
Closed

mem used frozen, swapused jumping #85

qubodup opened this issue Jan 1, 2015 · 2 comments

Comments

@qubodup
Copy link

qubodup commented Jan 1, 2015

Hi,

With my current setup, often the mem widget displaying mem_now.used value freezes and instead mem_now.swapused flashes during the update step, showing the current mem_now.used value, for some reason in the color (markup) of the mem widget.

Video:
http://youtu.be/YRNpK-6pgJg
Note: the flashing yellow value does change, although it's not identical to htop. In the video it's 1317 at first, changes to values like 1310, 1311 later, while the left constant yellow value stays the same, as it seems, the memused value when awesome starts/rc.lua runs.

Example screens:
wat2
wat

rc.lua:
http://codepad.org/qICre4sQ

theme:
http://codepad.org/ysmWeejM

I think it has to do with using the mem widget twice. Perhaps because of non-local variables (entirely guessing) in https://github.com/copycat-killer/lain/blob/master/widgets/mem.lua

Is one supposed not to use a widget twice?

@lcpz
Copy link
Owner

lcpz commented Jan 2, 2015

Is one supposed not to use a widget twice?

For this widget, yes.

This is the same situation as in #61: you're causing a race condition.

Rewrite your widgets like this:

-- memory/swap
memicon = wibox.widget.imagebox(beautiful.widget_mem)
swapicon = wibox.widget.imagebox(beautiful.widget_fs)
swapwidget = wibox.widget.textbox()
memwidget = lain.widgets.mem({
    timeout = 0.5,
    settings = function()
        widget:set_markup(markup("#e0da37", mem_now.used .. "MB "))
        swapwidget:set_markup(markup("#80d9d8", mem_now.swapused .. "MB "))
    end
})

It would be easy to make the widget asynchronous, but I prefer not in order to avoid such bad habits.

@qubodup
Copy link
Author

qubodup commented Jan 3, 2015

This solves it, thanks!

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

No branches or pull requests

2 participants