Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 8 insertions, 8 deletions
-rwxr-xr-xopenbox_de/bin/battery-status16
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