diff options
-rwxr-xr-x | battery | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 |