From de246ef27563ab3f6dbbd87f79349fd3242f33e1 Mon Sep 17 00:00:00 2001 From: ktyl Date: Thu, 19 Aug 2021 01:44:32 +0100 Subject: [PATCH] add backlight script and binds --- .config/sxhkd/sxhkdrc | 8 ++++++++ .scripts/backlight | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 .scripts/backlight diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index e6f23b2..3076ecc 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -138,6 +138,14 @@ super + {Left,Down,Up,Right} super + shift + g $SCRIPTS/toggle-gaps +# +# screen brightness +# +XF86MonBrightnessUp + $SCRIPTS/backlight + + +XF86MonBrightnessDown + $SCRIPTS/backlight - # # media keys diff --git a/.scripts/backlight b/.scripts/backlight new file mode 100755 index 0000000..cc41740 --- /dev/null +++ b/.scripts/backlight @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +step=2 +value=`xbacklight -get` + +# double, halve value or bail +if [ "$1" == "+" ]; then + let value*=$step +elif [ "$1" == "-" ]; then + let value/=$step +else + echo "usage: backlight +, backlight -" + exit 1 +fi + +# check range +min=1 +max=100 +[[ $value -lt $min ]] && value=$min +[[ $value -gt $max ]] && value=$max + +xbacklight -set $value -steps 10