Low battery indicator in i3

Default featured post

I’ve been working with i3 around 9 months now and so far it is one my favorite WM so far. It is easy to use, elegant, hackerish and geeky. However, there was a problem for long time which was bugging me and that was lack of warning dialog for low battery.

The situation got worse when few times my laptop turned off because battery was drained out and all of my works gone. To solve the problem, I did googling and came across with mixed responses which mostly followed by bunch of complex Bash script. Hence, I decided to expand a script I developed for IceWM battery checking around 3 years ago and make it workable for i3. The only changes I made including some bug fixes and adding auto lock screen and standby when battery has less than five percent charge. You need to pass your user’s password to the Bash script since “pm-suspend” command requires root privilege. You can download the script from this GitHub link,

Some people might prefer to use pm-hibernate which makes more sense. Though, in my case, hibernate crashes my laptop, that’s why for now I rely on suspend which serves the purpose.
Feel free to modify, clone the project.