diff options
-rw-r--r-- | .config/xbindkeys/main (renamed from .config/xbindkeys/main##template) | 18 | ||||
-rwxr-xr-x | .local/share/bin/brightness | 29 |
2 files changed, 34 insertions, 13 deletions
diff --git a/.config/xbindkeys/main##template b/.config/xbindkeys/main index a1b5251..4e27583 100644 --- a/.config/xbindkeys/main##template +++ b/.config/xbindkeys/main @@ -25,30 +25,22 @@ "pactl set-sink-volume @DEFAULT_SINK@ -1%" Mod1+Mod4+minus + XF86AudioLowerVolume "pactl set-sink-volume @DEFAULT_SINK@ +1%" Mod1+Mod4+equal - -"pactl set-sink-volume @DEFAULT_SINK@ +1%" XF86AudioRaiseVolume -"pactl set-sink-volume @DEFAULT_SINK@ -1%" - XF86AudioLowerVolume "pactl set-sink-mute @DEFAULT_SINK@ toggle" XF86AudioMute "pactl set-source-mute @DEFAULT_SOURCE@ toggle" XF86AudioMicMute -{% if yadm.hostname == "thoncc" %} -"xbacklight -inc 10 -time 100 -fps 60" - XF86MonBrightnessUp -"xbacklight -dec 10 -time 100 -fps 60" - XF86MonBrightnessDown -{% else %} -"brightness - 20" +"brightness -10" Shift+Mod4 + minus -"brightness + 20" + XF86MonBrightnessDown +"brightness +10" Shift+Mod4 + equal -{% endif %} + XF86MonBrightnessUp "playerctl play-pause" XF86AudioPlay 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 + |