A script that shows messages to the user when the battery is almost empty. I wrote this because I use i3wm, was frustrated by the lack of a nice battery notification, and as a nice exercise in shell scripting.
This script regularly checks your battery charge and shows you a nice warning in a popup if you are about to completely drain your battery. It improves on other battery warning scripts like this one by:
exec --no-startup-id i3-battery-popup
There's now a package on Arch Linux's AUR: https://aur.archlinux.org/packages/i3-battery-popup-git
If you have
wish installed this script will show you a popup window. To get wish, you probably need to install
tk on your Linux distribution.
The nice thing is that we can make the popup window sticky; that doesn't work with i3-nagbar. To make the popup sticky so it shows everywhere, add this to your i3 config:
for_window [title="Battery Warning"] sticky enable
-n to use those nice pretty desktop notifications in the top right corner of your screen. I guess it depends on something like
libnotify but I'm not really sure. Please correct me if I'm wrong.
-L sets the percentage at which the first popup shows. Default is 10
-l : The percentage at which the second popup shows. Default: half of the percentage given by
-m : The message to show to the User
-t : The time interval the script waits before checking the battery again.
Give this a value in seconds:
10s, or in minutes:
-n : Use notify-send for desktop notification
-i : Specify the icon to use with
-N : Don't use Tcl/Tk dialog. Use i3-nagbar.
-s : Play a sound with
paplay when notifying.
Takes a path to a sound as argument. The file must exist.
Default: no sound.
-v : Specifies the percentage of the volume of the sound played with
This value must be an integer greater than
0 and smaller than