Skip to content
forked from Ventto/batify

Bash script to set plug and battery level notifications using udev and libnotify for multi-xusers.

License

Notifications You must be signed in to change notification settings

BeiNacht/batify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Batify

License Version Language (Bash)

Batify is a Bash script to set easily plug and battery level notifications using udev rules and libnotify for single and multi-xusers.

Installation

Requirements

In order to use libnotify, you need to install a notification server.

Package (AUR)

$ yaourt -S batify

Manually

$ git clone https://github.com/Ventto/batify.git
$ cd batify
$ make
$ sudo make install

After installing batify, do not forget to reload udev rules:

$ udevadm control --reload-rules

Notifications

"A batifyrc configuration file is comming soon"

Current notifications:

notification level
Battery level is between 10% and 15% normal
Battery level is less than 9% critical
AC adapter plugged-in normal
AC adapter unplugged normal

Batify's files:

  • /etc/udev/rules.d/99-batify.rules
  • /usr/local/bin/batify.sh
  • /usr/share/icons/batify/*.png

Custom battery warnings

  • Edit batify.sh:
case ${_bat_capacity} in
	[0-9])  ntf_lvl=critical; icon="bat-critical" ;;
	1[0-5]) ntf_lvl=low;      icon="bat-low"      ;;

	# Custom warnings (battery half level)
	5[0-3]) ntf_lvl=normal; icon="bat-half" ;;
	50) ... ;;

	*) exit ;;
esac

Custom plug in/unplug notifications

  • Edit batify.sh:
if [ "${_bat_plug}" == "1" ]; then
	ntf_lvl="normal"; icon="bat-plug"
	ntf_msg="Power: plugged in"
else
	ntf_lvl="normal" ; icon="bat-unplug"
	ntf_msg="Power: unplugged"
fi

Custom icons

  • Edit batify.sh:
ICON_DIR="/usr/share/icons/batify"
#[...]
icon_path="${ICON_DIR}/${icon}.png"

About

Bash script to set plug and battery level notifications using udev and libnotify for multi-xusers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 70.9%
  • Makefile 29.1%