16 lines
389 B
Bash
Executable File
16 lines
389 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Prints all batteries and their percentage remaining
|
|
|
|
case $BLOCK_BUTTON in
|
|
1) notify-send "Battery status: $(cat "/sys/class/power_supply/BAT0/status")" ;;
|
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
|
esac
|
|
|
|
# Loop through all attached batteries.
|
|
for battery in /sys/class/power_supply/BAT?
|
|
do
|
|
capacity=$(cat "$battery"/capacity 2>/dev/null) || break
|
|
printf "%s%%" "$capacity"
|
|
done
|