aboutsummaryrefslogtreecommitdiff
path: root/home/bin/backlight
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2017-05-14 18:57:09 -0700
committerJakob Odersky <jakob@odersky.com>2017-05-14 18:57:09 -0700
commit402aa8879c1183519b3ccc836345b3b0e10e6134 (patch)
treebfe22d1fa7ec0f333cdd92b37d144f78731e0b80 /home/bin/backlight
parent5dddaa503dae4bce9c8de59b3c469f1e7ba0619a (diff)
downloaddotfiles-402aa8879c1183519b3ccc836345b3b0e10e6134.tar.gz
dotfiles-402aa8879c1183519b3ccc836345b3b0e10e6134.tar.bz2
dotfiles-402aa8879c1183519b3ccc836345b3b0e10e6134.zip
Adapt config to x260
Diffstat (limited to 'home/bin/backlight')
-rwxr-xr-xhome/bin/backlight27
1 files changed, 27 insertions, 0 deletions
diff --git a/home/bin/backlight b/home/bin/backlight
new file mode 100755
index 0000000..d18e58c
--- /dev/null
+++ b/home/bin/backlight
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+device=$(find /sys/class/backlight/* -maxdepth 1 | head -n 1)
+
+max=$(cat "$device/max_brightness")
+current=$(cat "$device/brightness")
+step=20
+
+case "$1" in
+ get)
+ echo "$current"
+ ;;
+ dec)
+ if [[ "$current" -gt 0 ]]; then
+ echo $(( $current - $step )) > "$device/brightness"
+ fi
+ ;;
+ inc)
+ if [[ "$current" -lt "$max" ]]; then
+ echo $(( $current + $step )) > "$device/brightness"
+ fi
+ ;;
+ *)
+ echo "Unknown argument $1" >&2
+ exit 1
+ ;;
+esac