aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-12-17 22:20:14 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-12-17 22:20:14 +0100
commitfe934727c9e833bedbcbc7a9f933256e564bafcc (patch)
treef2770b169623970c2fb8e39d94a4dbe48418b375
parentf551289c9705c5ed2a028f9a6d37b13c98467508 (diff)
downloadscripts-fe934727c9e833bedbcbc7a9f933256e564bafcc.tar.gz
scripts-fe934727c9e833bedbcbc7a9f933256e564bafcc.zip
i3battery.sh exits if no battery defined.
-rwxr-xr-xi3blocks/i3battery.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/i3blocks/i3battery.sh b/i3blocks/i3battery.sh
index 1be8142..256b199 100755
--- a/i3blocks/i3battery.sh
+++ b/i3blocks/i3battery.sh
@@ -12,6 +12,7 @@ case $BLOCK_BUTTON in
esac
battery="$CONFIG_BATTERY"
+[ -n "$battery" ] || exit 0
status=$(cat /sys/class/power_supply/"$battery"/status)
capacity=$(cat /sys/class/power_supply/"$battery"/capacity) || exit 0
[ -f "/bin/acpi" ] && remaining="$(acpi | cut -d' ' -f5 | cut -d':' -f-2)" || remaining="missing acpi"