luawindow-managersawesome-wm

AwesomeWM colors and values in progressbar and other wibox widgets do not update


I set up signals and functions to update colors of my container.background widgets and also one to update progressbar value and color according to battery level, but it doesnt work, any manipulations with widgets seems not working except changing text in text widgets.

I've tried many other's people solutions found on github. None of them worked. I've set up signals for monitoring wifi connection and battery, also functions that called to update status bars for sound and brightness but none of it works. But text fields update just fine. OS - Arch installed awesome from pacman. Here's my code of battery progress bar:

local battery_progress_bar = {
    color = beautiful.cred,
    max_value     = 100,
    value = 50,
    forced_width = 100,
    widget        = wibox.widget.progressbar,
}
local update_battery_bar = function(charge)
    battery_progress_bar.color = beautiful.cgreen
        -- Color doesn't change for some reason
    battery_progress_bar.value = charge
    text_bl_icon.text = charge 
    -- ive set this text widget just to see if right value is passed from my script
    -- this value changes and works perfectly, but progressbar doesnt
end

local function battery_emit()
  awful.spawn.easy_async_with_shell(
    battery_script, function(stdout)
    local level     = string.match(stdout:match('(%d+)'), '(%d+)')
    local level_int = tonumber(level) -- integer
    awesome.emit_signal('signal::battery', level_int)
  end)
end

-- Refreshing
-------------
gears.timer {
  timeout   = 20,
  call_now  = true,
  autostart = true,
  callback  = function()
    battery_emit()
  end
}

awesome.connect_signal("signal::battery", function(value)
    update_battery_bar(value)
end)

Also i'm sure that cgreen color that i use is defined and working if i will asign it to progress bar color at its initialization. Signal is actually emitting and triggering update function because number in text field changes.


Solution

  • The solution was that i'm using tables in provided code, but in order to change the values dynamically i need to convert them to widgets

    local battery_progress_bar = wibox.widget {
        color = beautiful.cred,
        max_value     = 100,
        value = 50,
        forced_width = 100,
        widget        = wibox.widget.progressbar,
    }
    

    And also, all of my textbox widgets were converted, that's why they worked while nothing other is. Hope this will help someone who otherwise would probably give up on idea of using awesome wm because nothing works, and don't know how to fix it or even google it.