aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbattery5
1 files changed, 5 insertions, 0 deletions
diff --git a/battery b/battery
index 12682d3..487610b 100755
--- a/battery
+++ b/battery
@@ -29,6 +29,11 @@ function battery_capacity {
healthy='#859900'
low='#b58900'
discharge='#dc322f'
+
+# Abort if no battery is available
+if [ ! -e "/sys/class/power_supply/BAT0" ]; then
+ exit
+fi
# Get battery status
if [ -e "/sys/class/power_supply/BAT0/charge" ]; then