From 922a06dbca3f8217d233686722a15a5571d4c489 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Thu, 21 May 2020 22:49:35 -0400 Subject: battery script handles off and on values --- src/usr/local/bin/bat-led-set | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/usr/local/bin/bat-led-set') 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 -- cgit