aboutsummaryrefslogtreecommitdiff
path: root/src/usr/local/bin
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-05-21 22:49:35 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-05-21 22:49:35 -0400
commit922a06dbca3f8217d233686722a15a5571d4c489 (patch)
tree89109be988bc360cef64229f08d8df5c6e979d34 /src/usr/local/bin
parentf1f5300506cff936a0f05e0b23e969a49413b7b6 (diff)
battery script handles off and on values
Diffstat (limited to 'src/usr/local/bin')
-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