]> gitweb.fluxo.info Git - scripts.git/commitdiff
Abort if no battery is available
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 5 May 2014 18:15:47 +0000 (15:15 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 5 May 2014 18:15:47 +0000 (15:15 -0300)
battery

diff --git a/battery b/battery
index 12682d3e452040648c238f9327b52762efa95bb3..487610ba043f116e1188cb4586c577d96084f370 100755 (executable)
--- 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