aboutsummaryrefslogtreecommitdiffstats
path: root/bin/brightness
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-05-06 02:01:23 +0200
committerDavid Runge <dave@sleepmap.de>2016-05-06 02:01:23 +0200
commitc976d0178f9b2fc05ab9a64f3ae28ee0a6b65417 (patch)
treea57206c2db4464d11044b1dc4813b490b1101ca8 /bin/brightness
parentfc655926d754d344908c78d4a53b76df8f23ecf6 (diff)
downloaddotfiles-c976d0178f9b2fc05ab9a64f3ae28ee0a6b65417.tar.gz
dotfiles-c976d0178f9b2fc05ab9a64f3ae28ee0a6b65417.tar.bz2
dotfiles-c976d0178f9b2fc05ab9a64f3ae28ee0a6b65417.tar.xz
dotfiles-c976d0178f9b2fc05ab9a64f3ae28ee0a6b65417.zip
bin/brightness: Adding script to increase/decrease backlight.
Diffstat (limited to 'bin/brightness')
-rwxr-xr-xbin/brightness23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/brightness b/bin/brightness
new file mode 100755
index 0000000..192dc4c
--- /dev/null
+++ b/bin/brightness
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Script to lower/ raise screen brightness using xbacklight (xorg-xbacklight)
+
+set -e -u
+
+export DISPLAY=:0
+x11user=$(w |grep -w :0 | cut -d " " -f1)
+export XAUTHORITY=/home/$x11user/.Xauthority
+step=5
+
+if [ -x /usr/bin/xbacklight ]; then
+ if [ "$1" = "video/brightnessup" ] && [ $2 = "BRTUP" ]; then
+ xbacklight -inc "$step"
+ elif [ "$1" = "video/brightnessdown" ] && [ $2 = "BRTDN" ]; then
+ xbacklight -dec "$step"
+ else
+ exit 1
+ fi
+else
+ exit 1
+fi
+
+exit 0