#!/bin/sh # Just a background script to tell you when your battery's low if you don't # have a panel. # Iris Lightshard # MIT License warn=30 crit=20 dismissed=0 while true; do charge=$(cat /sys/class/power_supply/BAT0/capacity) if [ $charge -lt $(($crit + 1)) ]; then notify-send -c power -t 100000 battery [${charge}%] elif [ $charge -lt $(($warn + 1)) ]; then if [ $dismissed -eq 0 ]; then dismissed=1 notify-send -c power -t 1000000 battery [${charge}%] fi fi if [ $charge -gt $warn ]; then dismissed=0 fi sleep 60 done