[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
|
widget = wibox.widget.textbox
|
||||||
}
|
}
|
||||||
|
|
||||||
timer = timer({ timeout = 10 })
|
local battery_timer = timer({ timeout = 10 })
|
||||||
timer:connect_signal("timeout", function() update() end)
|
battery_timer:connect_signal("timeout", function() battery_update() end)
|
||||||
timer:start()
|
battery_timer:start()
|
||||||
|
|
||||||
function update()
|
function battery_update()
|
||||||
local percent = utils.readfile("/sys/class/power_supply/BAT1/capacity")
|
local percent = utils.readfile("/sys/class/power_supply/BAT1/capacity")
|
||||||
local status = utils.readfile("/sys/class/power_supply/BAT1/status")
|
local status = utils.readfile("/sys/class/power_supply/BAT1/status")
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ function update()
|
||||||
battery_widget:set_markup(prefix .. percent)
|
battery_widget:set_markup(prefix .. percent)
|
||||||
end
|
end
|
||||||
|
|
||||||
update()
|
battery_update()
|
||||||
|
|
||||||
return wibox.container.margin(battery_widget, 4)
|
return wibox.container.margin(battery_widget, 4)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
local sensors_widget = wibox.widget{
|
local divider_widget = wibox.widget{
|
||||||
markup = '|',
|
markup = '|',
|
||||||
align = 'center',
|
align = 'center',
|
||||||
widget = wibox.widget.textbox
|
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
|
widget = wibox.widget.textbox
|
||||||
}
|
}
|
||||||
|
|
||||||
timer = timer({ timeout = 10 })
|
local sensors_timer = timer({ timeout = 10 })
|
||||||
timer:connect_signal("timeout", function() update() end)
|
sensors_timer:connect_signal("timeout", function() sensors_update() end)
|
||||||
timer:start()
|
sensors_timer:start()
|
||||||
|
|
||||||
function update()
|
function sensors_update()
|
||||||
local temp = utils.readfile("/sys/class/thermal/thermal_zone1/temp") / 1000
|
local temp = utils.readfile("/sys/class/thermal/thermal_zone1/temp") / 1000
|
||||||
|
|
||||||
sensors_widget:set_markup(string.format("%02d", temp) .. "°C")
|
sensors_widget:set_markup(string.format("%02d", temp) .. "°C")
|
||||||
end
|
end
|
||||||
|
|
||||||
update()
|
sensors_update()
|
||||||
|
|
||||||
return wibox.container.margin(sensors_widget, 4)
|
return wibox.container.margin(sensors_widget, 4)
|
||||||
|
|
Reference in a new issue