diff options
Diffstat (limited to 'awesome/widgets/temperature.lua')
-rw-r--r-- | awesome/widgets/temperature.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/awesome/widgets/temperature.lua b/awesome/widgets/temperature.lua new file mode 100644 index 0000000..8cf1aa9 --- /dev/null +++ b/awesome/widgets/temperature.lua @@ -0,0 +1,25 @@ +local wibox = require("wibox") +local widgets = require("util.widgets") +local osname = require("util.osname") + + +local linux = { file = nil } +function linux.temperature(widget) + -- read meminfo + local tempf = io.open(linux.file) + local temp = tempf:read() / 1000 + tempf:close() + + widget:set_text(math.floor(temp)) +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") |