dwmblock-battery (509B)
1 #!/bin/sh 2 # dwmblocks script for battery information 3 case "$BUTTON" in 4 6) "$TERMINAL" -e "$EDITOR" "$0" ;; 5 esac 6 7 status="$(battery | tac | tr -d '\n' | sed ' 8 s/Charging/⚡ /; 9 /Discharging[01][0-9]$/s/Discharging/‼ /; 10 s/Discharging/🔋 /; 11 s/Not charging/⛔/; 12 s/Full/✅/; 13 s/Unknown/‽‽/' \ 14 | tac | tr -d '\n')" 15 16 case "$status" in 17 ‼*) notify "Battery low" "$status%" battery critical;; 18 ✅*) notify "Battery charged" "$status%" battery;; 19 esac 20 printf "%s%%\n" "$status"