diff options
| Commit | c27f36a146d44325e33a24471375c8e8cdf71158 (patch) | |
|---|---|---|
| Author | 2026-11-01 18:47:37 +0200 | |
| Committer | 2026-11-01 18:47:37 +0200 | |
| Files | 975ad6fc6816a3f0ccd3b9736a2729ed81806a9a | |
| .files-c27f36a146d44325e33a24471375c8e8cdf71158.tar .files-c27f36a146d44325e33a24471375c8e8cdf71158.tar.gz .files-c27f36a146d44325e33a24471375c8e8cdf71158.zip | ||
| Parent | f4a983d50dd6b9acd247503468116f5a21534a32 (diff) | |
fix(openbox_de): Properly quote variables in battery-status
1 files changed, 8 insertions, 8 deletions
| -rwxr-xr-x | openbox_de/bin/battery-status | 16 |
diff --git a/openbox_de/bin/battery-status b/openbox_de/bin/battery-status index 4201b58..597a4c1 100755 --- a/openbox_de/bin/battery-status +++ b/openbox_de/bin/battery-status @@ -12,15 +12,15 @@ for bat in BAT0 BAT1; do [ "$(awk '/native-path/{print $2}' "/tmp/$bat")" = '(null)' ] && continue bat_state="$(awk '/state/{print substr($2, 1, 1)}' "/tmp/$bat")" - if [ $bat_state = 'c' ]; then bat_power_ind='' - elif [ $bat_state = 'd' ]; then bat_power_ind='' + if [ "$bat_state" = 'c' ]; then bat_power_ind='' + elif [ "$bat_state" = 'd' ]; then bat_power_ind='' else bat_power_ind='' fi bat_per="$(awk '/percentage/{print strtonum($2)}' "/tmp/$bat")" # bat_per=$((bat_per * 5 / 4 - 25)) # compensation for failing battery - [ $bat_state = 'd' ] \ + [ "$bat_state" = 'd' ] \ && bat_time="$(awk '/time to empty/{print $4 substr($5, 1, 1)}' "/tmp/$bat")" \ || bat_time="$(awk '/time to full/ {print $4 substr($5, 1, 1)}' "/tmp/$bat")" @@ -36,18 +36,18 @@ for bat in BAT0 BAT1; do # Notify when battery is charged to 80% - if [ $bat_state = 'c' ]; then - if [ "$bat_notif" != 80 ] && [ $bat_per -ge 80 ]; then + if [ "$bat_state" = 'c' ]; then + if [ "$bat_notif" != 80 ] && [ "$bat_per" -ge 80 ]; then notify-send -u normal -i battery-charging -t 999999 "$bat at 80%" echo 80 > "/tmp/bat_notif$bat" fi # Notify when battery discharges to 5%, 10%, 15% and 20% - elif [ $bat_state = 'd' ]; then + elif [ "$bat_state" = 'd' ]; then for per in 5 10 15 20; do - if [ "$bat_notif" = $per ]; then + if [ "$bat_notif" = "$per" ]; then break - elif [ $bat_per -le $per ]; then + elif [ "$bat_per" -le "$per" ]; then notify-send -u critical -i battery-low -t 999999 "$bat at ${per}%" echo $per > "/tmp/bat_notif$bat" break |
