summaryrefslogtreecommitdiff
path: root/.local/bin/dwmbar/dwmb-battery
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-01-08 06:32:43 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2024-01-08 06:32:43 -0500
commite481a5a8f4773a1e54f1a701fc9a4da08d9970f8 (patch)
treed1a0bc0c95b91c7ef76aa5996116a3769433346d /.local/bin/dwmbar/dwmb-battery
parentf78d3d72ea10c132858f4c07496257a1aafec187 (diff)
Lint dwmblocks scripts
Diffstat (limited to '.local/bin/dwmbar/dwmb-battery')
-rwxr-xr-x.local/bin/dwmbar/dwmb-battery15
1 files changed, 7 insertions, 8 deletions
diff --git a/.local/bin/dwmbar/dwmb-battery b/.local/bin/dwmbar/dwmb-battery
index 007bae4..2062468 100755
--- a/.local/bin/dwmbar/dwmb-battery
+++ b/.local/bin/dwmbar/dwmb-battery
@@ -4,26 +4,25 @@
# to charge status.
case $BLOCK_BUTTON in
- 3) notify-send " Battery module" " : discharging
- : not charging
- : stagnant charge
+3) notify-send " Battery module" " : discharging
 : charging
+󰚦 : not charging
 : charged
- : battery very low!" ;;
+ : discharging
+ : battery very low!" ;;
esac
# acpi alternative
# acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, / /;s/[Nn]ot charging, / /;s/[Cc]harging, / /;s/[Uu]nknown, /♻️/;s/[Ff]ull, / /;s/ \(remaining\|until charged\)//"; exit
# Loop through all attached batteries.
-for battery in /sys/class/power_supply/BAT?
-do
+for battery in /sys/class/power_supply/BAT?; do
# Get its remaining capacity and charge status.
capacity=$(cat "$battery"/capacity 2>/dev/null) || break
- status=$(sed "s/[Dd]ischarging/ /;s/[Nn]ot charging/ /;s/[Cc]harging/ /;s/[Uu]nknown/♻️/;s/[Ff]ull/ /" "$battery"/status)
+ status=$(sed "s/[Dd]ischarging/ /;s/[Nn]ot charging/󰚦 /;s/[Cc]harging/ /;s/[Uu]nknown/ /;s/[Ff]ull/ /" "$battery"/status)
# If it is discharging and 25% or less, we will add a  as a warning.
- [ "$capacity" -le 25 ] && [ "$status" = " " ] && warn=" "
+ [ "$capacity" -le 25 ] && [ "$status" = " " ] && warn=" "
printf "%s%s%s%%" " $status" "$warn" "$capacity"
unset warn