diff options
Diffstat (limited to 'bin/brightness')
-rwxr-xr-x | bin/brightness | 23 |
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 |