diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-17 19:17:49 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-17 19:17:49 -0500 |
commit | 36b45cb895303f4b8bdd99a737259740129e1fb9 (patch) | |
tree | c463be93caa340eb389a7b85ba155d2855b1e244 /awesome/widgets/temperature.lua | |
parent | 3d98a08123c0c79641dd27516ef776747710ad4a (diff) | |
download | dotconfig-36b45cb895303f4b8bdd99a737259740129e1fb9.tar.xz dotconfig-36b45cb895303f4b8bdd99a737259740129e1fb9.zip |
add current awesome configs
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") |