aboutsummaryrefslogtreecommitdiff
path: root/files/usr/local/libexec/thinkpad-brightness.laptop
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-08-02 19:10:39 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-08-02 19:10:39 -0400
commitcbcd022f302adc39ecb89fba6faf72e68184c0e0 (patch)
treea5ab154e08fa3c4fa110b09d3475736c66840c8b /files/usr/local/libexec/thinkpad-brightness.laptop
parentceb339370d7a0cc4a83fe54103a650dfb3f72261 (diff)
downloadinfrastructure-cbcd022f302adc39ecb89fba6faf72e68184c0e0.tar.gz
halfway working idm server and laptop hostclasses
Diffstat (limited to 'files/usr/local/libexec/thinkpad-brightness.laptop')
-rw-r--r--files/usr/local/libexec/thinkpad-brightness.laptop31
1 files changed, 31 insertions, 0 deletions
diff --git a/files/usr/local/libexec/thinkpad-brightness.laptop b/files/usr/local/libexec/thinkpad-brightness.laptop
new file mode 100644
index 0000000..16cc01a
--- /dev/null
+++ b/files/usr/local/libexec/thinkpad-brightness.laptop
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+cur=$(/usr/bin/backlight -q)
+
+case $1 in
+ up)
+ if [ "$cur" -ge 50 ]; then
+ delta=10
+ elif [ "$cur" -ge 10 ]; then
+ delta=5
+ else
+ delta=2
+ fi
+
+ /usr/bin/backlight incr "$delta"
+ ;;
+ down)
+ if [ "$cur" -le 10 ]; then
+ delta=2
+ elif [ "$cur" -le 50 ]; then
+ delta=5
+ else
+ delta=10
+ fi
+
+ /usr/bin/backlight decr "$delta"
+ ;;
+ *)
+ exit 1
+ ;;
+esac