diff options
| author | Syndamia <kamen@syndamia.com> | 2023-05-20 11:18:32 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2023-05-20 11:18:32 +0300 |
| commit | 80725cd14990085239af5229eacc00ad3bbabfe1 (patch) | |
| tree | 1a5531a82be7c76735d1aa845b65e5fb2154b7dd | |
| parent | 6ec1d80e9a06d13777af00f250527af9369d472c (diff) | |
| download | dotfiles-80725cd14990085239af5229eacc00ad3bbabfe1.tar dotfiles-80725cd14990085239af5229eacc00ad3bbabfe1.tar.gz dotfiles-80725cd14990085239af5229eacc00ad3bbabfe1.zip | |
[.a] Fixed battery-status.sh notifications
Since all batteries used the same file for storing last notif, the
notifications would get spammed relentlessly.
| -rwxr-xr-x | .a/battery-status.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/.a/battery-status.sh b/.a/battery-status.sh index 956330e..d446fcd 100755 --- a/.a/battery-status.sh +++ b/.a/battery-status.sh @@ -30,15 +30,15 @@ for bat in BAT0 BAT1; do # command -v notify-send >/dev/null 2>&1 || exit - [ ! -e '/tmp/bat_notif' ] && touch /tmp/bat_notif - bat_notif="$(cat /tmp/bat_notif)" + [ ! -e "/tmp/bat_notif$bat" ] && touch "/tmp/bat_notif$bat" + bat_notif="$(cat "/tmp/bat_notif$bat")" # Notify when battery is charged to 80% 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 + echo 80 > "/tmp/bat_notif$bat" fi # Notify when battery discharges to 5%, 10%, 15% and 20% @@ -48,7 +48,7 @@ for bat in BAT0 BAT1; do break elif [ $bat_per -le $per ]; then notify-send -u critical -i battery-low -t 999999 "$bat at ${per}%" - echo $per > /tmp/bat_notif + echo $per > "/tmp/bat_notif$bat" break fi done @@ -56,8 +56,8 @@ for bat in BAT0 BAT1; do # Notify when battery is full else if [ "$bat_notif" != 100 ]; then - notify-send -u normal -i battery-full -t 999999 'Fully charged!' - echo 100 > /tmp/bat_notif + notify-send -u normal -i battery-full -t 999999 "$bat fully charged!" + echo 100 > "/tmp/bat_notif$bat" fi fi done |
