blob: a30e1ed3e0ff33cc486b8ea5e5982ab9aa262447 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
local wibox = require("wibox")
local widgets = require("util.widgets")
local linux = { file = nil }
function linux.temperature(widget)
-- read meminfo
local tempf = io.open(linux.file)
if tempf then
local temp = tempf:read() / 1000
tempf:close()
widget:set_text(math.floor(temp))
else
widget:set_text("err")
end
end
-- return correct widget for os
if osname == "Linux" then
return function(file)
linux.file = file
return widgets.watchfn(linux.temperature, 5)
end
end
return wibox.widget.textbox("unsupported os")
|