Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

batAlert

Never forget to charge your laptop again. Or still forget, but at least this script tried to warn you.

batAlert is a lightweight bash script designed to run in the background as a cron job. It monitors your battery level and pushes a critical desktop notification when your power drops below a defined threshold while discharging.


Prerequisites

The script relies on notify-send to push critical GUI warnings to your desktop environment.

Ubuntu

sudo apt-get install notify-osd

Debian:

sudo apt-get install libnotify-bin

Other Distributions: Install it via your standard package manager, or visit vaskovsky.net for guidance.


Installation & Setup

  1. Download or clone the script to your machine.
  2. Make it executable:
 chmod +x batAlert.sh
  1. Move the script to a permanent location (e.g., ~/scripts/batAlert.sh).
  2. Open your crontab configuration:
 crontab -e
  1. Add the following line to run the script every minute (make sure to replace /path/to/ with your actual directory path):
 * * * * * /path/to/batAlert.sh >> /tmp/battery.log

Configuration

By default, the script will trigger an alert when your battery hits 10%. You can adjust this by opening batAlert.sh and editing the THRESHOLD variable on line 9:

THRESHOLD="10" # Change this to your preferred percentage

Free to use. Open source. Lovely.

About

Never forget charging your laptop. Or still forget, but atleast this tried to warn you.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages