From d3f2c801c39d42726c0cff4f9fd005664f87b26c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 5 Sep 2021 13:45:09 +0300 Subject: (1) Added exiting of battery status script when there is no battery --- battery-status.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'battery-status.sh') diff --git a/battery-status.sh b/battery-status.sh index 990036e..efbc2a2 100755 --- a/battery-status.sh +++ b/battery-status.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [[ "$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep native-path | awk '{print $2}')" == '(null)' ]]; then + exit +fi + battery_notify () { # if battery percentage is equal to given one, if battery percentage inside /tmp/battery.tmp is not equal to given one and if power indicator is the given on if [ ${__bat_per} -eq $1 ] && ! grep -q $1 "/tmp/battery.tmp" && [[ ${__bat_power} = $2 ]]; then -- cgit v1.2.3