[awesome] use unique variable names for widgets
This commit is contained in:
parent
9541b7e02f
commit
f6822896ff
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in a new issue