summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2023-02-09 11:08:45 -0600
committerzachir <zachir@librem.one>2023-02-09 11:08:45 -0600
commitdbee0aab13c3dff4bac390f3ba75da9b3d55322d (patch)
tree8512c4fcc83c9e194670b27ed9c8de8f181020b6
parent81842c8b3912b5657d7a05b5dbc3924f03301e58 (diff)
add backlight generic command (light or xbacklight)
-rw-r--r--bl47
1 files changed, 47 insertions, 0 deletions
diff --git a/bl b/bl
new file mode 100644
index 0000000..f220e4f
--- /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 "$1"
+ ;;
+ "-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 "$1"
+ ;;
+ "-g")
+ xbacklight -get
+ ;;
+ "*")
+ printf "$CMD: $1 not understood. Treating it as a direct command."
+ xbacklight "$@"
+ ;;
+ esac
+esac