diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-23 20:43:24 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-23 20:43:24 +0100 |
commit | 7bad3080d2882b01ae89daaaba506b4f86dc53f0 (patch) | |
tree | 6d0ffadb670b382dadd86667bab6e3373c795444 /.local/share | |
parent | df4cc7dd374c8415da1be263de9fcd0524fbe033 (diff) |
add brightness script
Diffstat (limited to '.local/share')
-rwxr-xr-x | .local/share/bin/brightness | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/.local/share/bin/brightness b/.local/share/bin/brightness new file mode 100755 index 0000000..c1c6139 --- /dev/null +++ b/.local/share/bin/brightness @@ -0,0 +1,29 @@ +#!/bin/sh +case "$*" in + +*) action="+" ;; + -*) action="-" ;; + *) action="=" ;; +esac +value="$(echo "$*" | tr -dc '[[:digit:]]')" + +if [ -n "$(command -v xbacklight)" ] ; then + [ "$action" = "+" ] && action="-inc" + [ "$action" = "-" ] && action="-dec" + [ "$action" = "=" ] && action="-set" + + fork xbacklight -time 100 -fps 60 $action $value + + exit 0 + +elif [ -n "$(command -v ddcutil)" ] ; then + [ "$action" = "=" ] && action="" + + for bus in 2 3 ; do + fork ddcutil --bus="$bus" --skip-ddc-checks --noverify setvcp 10 $action $value + done + + exit 0 + +fi +exit 1 + |