[awesome] use unique variable names for widgets

This commit is contained in:
Simon Bruder 2018-10-28 14:19:01 +00:00
parent 9541b7e02f
commit f6822896ff
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
3 changed files with 12 additions and 12 deletions

View file

@ -8,11 +8,11 @@ local battery_widget = wibox.widget{
widget = wibox.widget.textbox
}
timer = timer({ timeout = 10 })
timer:connect_signal("timeout", function() update() end)
timer:start()
local battery_timer = timer({ timeout = 10 })
battery_timer:connect_signal("timeout", function() battery_update() end)
battery_timer:start()
function update()
function battery_update()
local percent = utils.readfile("/sys/class/power_supply/BAT1/capacity")
local status = utils.readfile("/sys/class/power_supply/BAT1/status")
@ -27,6 +27,6 @@ function update()
battery_widget:set_markup(prefix .. percent)
end
update()
battery_update()
return wibox.container.margin(battery_widget, 4)

View file

@ -1,9 +1,9 @@
local wibox = require("wibox")
local sensors_widget = wibox.widget{
local divider_widget = wibox.widget{
markup = '|',
align = 'center',
widget = wibox.widget.textbox
}
return wibox.container.margin(sensors_widget, 4)
return wibox.container.margin(divider_widget, 4)

View file

@ -8,16 +8,16 @@ local sensors_widget = wibox.widget{
widget = wibox.widget.textbox
}
timer = timer({ timeout = 10 })
timer:connect_signal("timeout", function() update() end)
timer:start()
local sensors_timer = timer({ timeout = 10 })
sensors_timer:connect_signal("timeout", function() sensors_update() end)
sensors_timer:start()
function update()
function sensors_update()
local temp = utils.readfile("/sys/class/thermal/thermal_zone1/temp") / 1000
sensors_widget:set_markup(string.format("%02d", temp) .. "°C")
end
update()
sensors_update()
return wibox.container.margin(sensors_widget, 4)