Battmon is simple battery monitoring program written in python for Linux systems, which has especially in mind tiling window managers like xmonad, dwm or awesome.
- very light (for really basic functionality you need have only python installed)
- works in background
- very configurable
- no tray icon
- pop-up notifications (need libnotify)
- don't have to be run as root user
- ... and more options can be given through the command line
- python: for really basic functionality (>=3.2 and >=2.7 are supported, if you have older python version, install argparse)
Optional prerequisites:
- libnotify: pop up notifications (works fine with dunst)
- sox / pulseaudio: sounds
- screen lock programs like: i3lock, xtrlock, xscreensaver, physlock, xlockmore etc, to lock user session before hibernating or suspending
(you can specify your favorite screen locker through command line or in config.py file) - pm-utils: for hibernate, suspend or shutdown system on critical battery level (if not installed, the scripts in 'bin' directory will be used, see below)
-
Just run:
python ./battmon.py
-
to see all available options run Battmon with
-h
or--help
option.
-
Currently systemd/upower isn't supported and probably will never be.
-
If you have pm-utils installed, then please remember that, following commands must been execute as a root user. To do so just edit
/etc/sudoers
file and add something similar like this, replacingusername
with your own user name:your_username ALL = NOPASSWD: /usr/sbin/pm-hibernate your_username ALL = NOPASSWD: /usr/sbin/pm-suspend your_username ALL = NOPASSWD: /usr/sbin/pm-suspend-hybrid
or enable it for a group, remember to replace group and
PATH_TO_BATTMON
:%your_group ALL = NOPASSWD: /usr/sbin/pm-hibernate %your_group ALL = NOPASSWD: /usr/sbin/pm-suspend %your_group ALL = NOPASSWD: /usr/sbin/pm-suspend-hybrid
-
If you don't have pm-utils installed, scripts in
bin
folder must be executed as a root, to allow regular user suspend, hibernate or shutdown computer. The easiest way to to do this, is to make this scripts accessible to normal user by running sudo without root password. To do so just edit/etc/sudoers
file and add something like this, replacing username with your own user name andPATH_TO_BATTMON
with absolute path to your Battmon folder:your_username ALL = NOPASSWD: /PATH_TO_BATTMON/bin/suspend.sh your_username ALL = NOPASSWD: /PATH_TO_BATTMON/bin/hibernate.sh your_username ALL = NOPASSWD: /PATH_TO_BATTMON/bin/shutdown.sh
or enable it for a group, remember to replace group and
PATH_TO_BATTMON
:%your_group ALL = NOPASSWD: /PATH_TO_BATTMON/bin/suspend.sh %your_group ALL = NOPASSWD: /PATH_TO_BATTMON/bin/hibernate.sh %your_group ALL = NOPASSWD: /PATH_TO_BATTMON/bin/shutdown.sh
-
Sound file is search by default in the same path where battmon was started, you can change this by parsing your path to your sound file using
-sp
argument without quotes. -
You can specify your favor lock screen command using
-lp
argument in command line, if none given, then as default will be used first one found inSCREEN_LOCK_COMMANDS
list variable inconfig.py
file. You can also change default screenlock command editingDEFAULT_SCREEN_LOCK_COMMAND
variable ininternal_config.py
file, but this will be overwritten when screen lock command was given in command line using-lp
argument. -
For more information about configuration see
README
file in Battmon directory
- Please tell me ;)