diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 47c8db7b..317b0c0d 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -621,3 +621,23 @@ if not startupDone() then awful.spawn(app) end end + +-- low battery notification +gears.timer { + timeout = 60, + call_now = true, + autostart = true, + callback = function() + awful.spawn.easy_async_with_shell([[bash -c "cat /sys/class/power_supply/BAT1/capacity"]], + function(stdout) + if tonumber(stdout) <= 15 then + batterynotification = naughty.notify { + title = "Battery Warning\n", + text = "Battery is lower than 15%.\nStatus is " .. tonumber(stdout) .. "%.", + timeout = 3, + } + end + end + ) + end +}