diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:49:17 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:49:17 -0500 |
commit | 923eb46350b1102749eb05cd2120c96cc6a715d0 (patch) | |
tree | 811da20b4195d4b5c65c8ac0090982a4a23f6a7d /widgets/battery.lua | |
download | awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.tar.xz awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.zip |
initial commit
Diffstat (limited to 'widgets/battery.lua')
-rw-r--r-- | widgets/battery.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/widgets/battery.lua b/widgets/battery.lua new file mode 100644 index 0000000..f6e6860 --- /dev/null +++ b/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 |