summaryrefslogtreecommitdiff
path: root/awesome/widgets/battery.lua
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2024-10-17 22:29:52 -0500
committerTim Keller <tjk@tjkeller.xyz>2024-10-17 22:29:52 -0500
commit572382a9ce99162bd93d2d6e3fd789f2c99bf420 (patch)
tree676e1beca156d8a145f05462573ca101986783fa /awesome/widgets/battery.lua
parente74ea1ed238500d48d3df0c8a5e15e4fd0bd0fcf (diff)
downloaddotconfig-572382a9ce99162bd93d2d6e3fd789f2c99bf420.tar.xz
dotconfig-572382a9ce99162bd93d2d6e3fd789f2c99bf420.zip
lowbat widget and remove old classiclayoutbox
Diffstat (limited to 'awesome/widgets/battery.lua')
-rw-r--r--awesome/widgets/battery.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/awesome/widgets/battery.lua b/awesome/widgets/battery.lua
new file mode 100644
index 0000000..f6e6860
--- /dev/null
+++ b/awesome/widgets/battery.lua
@@ -0,0 +1,24 @@
+local awful = require("awful")
+local wibox = require("wibox")
+local naughty = require("naughty")
+
+local widget = wibox.widget.textbox()
+
+-- update widget on lowbat output
+local lowbat_pid = awful.spawn.with_line_callback("lowbat", {
+ stdout = function(stdout)
+ widget:set_text(stdout)
+ end,
+ stderr = function(stderr)
+ naughty.notify({
+ preset = naughty.config.presets.critical,
+ title = "lowbat error",
+ text = stderr
+ })
+ end,
+})
+
+-- kill current lowbat on refresh/exit
+awesome.connect_signal("exit", function() awful.spawn("kill " .. lowbat_pid) end)
+
+return widget