24 lines
607 B
Lua
24 lines
607 B
Lua
local timer = require("gears.timer")
|
|
local wibox = require("wibox")
|
|
local utils = require("utils")
|
|
|
|
local sensors_widget = wibox.widget{
|
|
markup = '00°C',
|
|
align = 'center',
|
|
widget = wibox.widget.textbox
|
|
}
|
|
|
|
local sensors_timer = timer({ timeout = 10 })
|
|
sensors_timer:connect_signal("timeout", function() sensors_update() end)
|
|
sensors_timer:start()
|
|
|
|
function sensors_update()
|
|
local temp = utils.readfile("/sys/class/thermal/thermal_zone1/temp") / 1000
|
|
|
|
sensors_widget:set_markup(string.format("%02d", temp) .. "°C")
|
|
end
|
|
|
|
sensors_update()
|
|
|
|
return wibox.container.margin(sensors_widget, 4)
|