aboutsummaryrefslogtreecommitdiff
path: root/src/usr/local/bin/bat-led-set
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/bin/bat-led-set')
-rwxr-xr-xsrc/usr/local/bin/bat-led-set8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/usr/local/bin/bat-led-set b/src/usr/local/bin/bat-led-set
index 1c59a05..22a2b6a 100755
--- a/src/usr/local/bin/bat-led-set
+++ b/src/usr/local/bin/bat-led-set
@@ -1,3 +1,9 @@
#!/bin/sh
-cat /sys/class/power_supply/BAT*/capacity | xargs -n1 test 5 -ge && echo $1 >/sys/class/leds/input3::capslock/brightness
+if sh -c "cat /sys/class/power_supply/BAT*/capacity | xargs -n1 test 5 -ge"; then
+ export OUT=1
+else
+ export OUT=0
+fi
+
+[ $1 = $OUT ] && echo $OUT >/sys/class/leds/input3::capslock/brightness