aboutsummaryrefslogtreecommitdiff
path: root/files/usr/local/libexec/thinkpad-brightness.laptop
diff options
context:
space:
mode:
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