summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2023-02-09 21:23:03 -0600
committerzachir <zachir@librem.one>2023-02-09 21:23:03 -0600
commit3c8f6acf1df57b5eb09b1f95f886747ba14de4f8 (patch)
tree3677b9feedf6b0c17294088ceb74d51703d378ed
parent22e8f8c134dac828f997519dbf0bdba0d3a4abdc (diff)
parent4ec61c0f9527e4f0ecce57a8b869270d8a42734e (diff)
Merge branch 'master' of git.zachir.xyz:zachir/generics
-rwxr-xr-xbl47
1 files changed, 47 insertions, 0 deletions
diff --git a/bl b/bl
new file mode 100755
index 0000000..de3b133
--- /dev/null
+++ b/bl
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+## Backlight controller generic: use either light or xbacklight
+
+CMD=`crcparse bl`
+
+case "$CMD" in
+ "light")
+ case "$1" in
+ "-i")
+ light -A "$2"
+ ;;
+ "-d")
+ light -U "$2"
+ ;;
+ "-s")
+ light -S "$2"
+ ;;
+ "-g")
+ light -G
+ ;;
+ "*")
+ printf "$CMD: $1 not understood. Treating it as a direct command."
+ light "$@"
+ ;;
+ esac
+ ;;
+ "xbacklight")
+ case "$1" in
+ "-i")
+ xbacklight -inc "$2"
+ ;;
+ "-d")
+ xbacklight -dec "$2"
+ ;;
+ "-s")
+ xbacklight -set "$2"
+ ;;
+ "-g")
+ xbacklight -get
+ ;;
+ "*")
+ printf "$CMD: $1 not understood. Treating it as a direct command."
+ xbacklight "$@"
+ ;;
+ esac
+esac