From 80725cd14990085239af5229eacc00ad3bbabfe1 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 20 May 2023 11:18:32 +0300 Subject: [.a] Fixed battery-status.sh notifications Since all batteries used the same file for storing last notif, the notifications would get spammed relentlessly. --- .a/battery-status.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '.a') 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 -- cgit v1.2.3