add battery notification
This commit is contained in:
parent
6bd4ba642b
commit
f6d8e4476f
1 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue