diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-06-03 19:56:25 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-06-03 19:56:25 +0200 |
commit | f0b527f61e251a879a179ff4fef16baaa486c047 (patch) | |
tree | 643a5717fcf243c5430cf8b0609d23bd2fa41b59 /sb-battery | |
parent | 95a142be5215939fc6b5be643e4fa44650415e2c (diff) | |
download | scripts-f0b527f61e251a879a179ff4fef16baaa486c047.tar.gz scripts-f0b527f61e251a879a179ff4fef16baaa486c047.tar.bz2 scripts-f0b527f61e251a879a179ff4fef16baaa486c047.zip |
update
Diffstat (limited to 'sb-battery')
-rwxr-xr-x | sb-battery | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/sb-battery b/sb-battery deleted file mode 100755 index abfb53c..0000000 --- a/sb-battery +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# Display the current battery status. - -notify() { - dunstify \ - -i battery-good-symbolic \ - -t 4000 \ - -h string:x-canonical-private-synchronous:battery \ - "Battery" "$1" -} - -case "$BLOCK_BUTTON" in - 1) notify "$(acpi -b | awk -F ': |, ' '{printf "%s\n%s\n", $2, $4}')" ;; - 3) ghostty -e "$EDITOR" "$0" ;; -esac - -. sb-theme - -# Loop through all attached batteries. -for battery in /sys/class/power_supply/BAT?*; do - # If non-first battery, print a space separator. - [ -n "${capacity+x}" ] && printf " " - - capacity="$(cat "$battery/capacity" 2>&1)" - if [ "$capacity" -gt 90 ]; then - status=" " - elif [ "$capacity" -gt 60 ]; then - status=" " - elif [ "$capacity" -gt 40 ]; then - status=" " - elif [ "$capacity" -gt 10 ]; then - status=" " - else - status=" " - fi - - case "$(cat "$battery/status" 2>&1)" in - Full) status=" " ;; - Discharging) - if [ "$capacity" -le 20 ]; then - status="$status" - color=1 - fi - ;; - Charging) status="$status" ;; - "Not charging") status=" " ;; - Unknown) status="? $status" ;; - *) exit 1 ;; - esac - - display "$status$capacity%" "$color" -done |