diff options
| author | ivan-boikov <ik.boikov.public@protonmail.com> | 2022-05-22 18:11:15 +0200 |
|---|---|---|
| committer | ivan-boikov <ik.boikov.public@protonmail.com> | 2022-05-22 18:11:15 +0200 |
| commit | 688f02cc56104ef13dc923ee86c9801cecf0f759 (patch) | |
| tree | 850a13167c7bdbc6f3be9bc6d2877090b2065805 /scripts/.local/bin/statusbar/sb-battery | |
| parent | 832badeaff2a74f19416f5fe637985ff93105423 (diff) | |
updated scripts
Diffstat (limited to 'scripts/.local/bin/statusbar/sb-battery')
| -rwxr-xr-x | scripts/.local/bin/statusbar/sb-battery | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/scripts/.local/bin/statusbar/sb-battery b/scripts/.local/bin/statusbar/sb-battery index 93cbe08..04a3cf7 100755 --- a/scripts/.local/bin/statusbar/sb-battery +++ b/scripts/.local/bin/statusbar/sb-battery @@ -1,20 +1,6 @@ #!/bin/sh -# Prints all batteries, their percentage remaining and an emoji corresponding -# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). - -case $BLOCK_BUTTON in - 3) notify-send "🔋 Battery module" "🔋: discharging -🛑: not charging -♻: stagnant charge -🔌: charging -⚡: charged -❗: battery very low! -- Scroll to change adjust xbacklight." ;; - 4) xbacklight -inc 10 ;; - 5) xbacklight -dec 10 ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac +# Prints all batteries, their percentage remaining # Loop through all attached batteries and format the info for battery in /sys/class/power_supply/BAT?*; do @@ -22,16 +8,16 @@ for battery in /sys/class/power_supply/BAT?*; do [ -n "${capacity+x}" ] && printf " " # Sets up the status and capacity case "$(cat "$battery/status" 2>&1)" in - "Full") status="⚡" ;; - "Discharging") status="🔋" ;; - "Charging") status="🔌" ;; - "Not charging") status="🛑" ;; - "Unknown") status="♻️" ;; + "Full") status="F" ;; + "Discharging") status="-" ;; + "Charging") status="+" ;; + "Not charging") status="" ;; + "Unknown") status="?" ;; *) exit 1 ;; esac capacity="$(cat "$battery/capacity" 2>&1)" # Will make a warn variable if discharging and low - [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗" + [ "$status" = "D" ] && [ "$capacity" -le 25 ] && warn="!!!" # Prints the info - printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn + printf "%d%%%s%s" "$capacity" "$status" "$warn" ; unset warn done && printf "\\n" |
