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")