hyprland: add hypr_brightness script
This script uses ddcutil and allows you to also control the brightness of external displays. It changes the brightness of the display that you are currently focused in.
This commit is contained in:
parent
b4ff09016c
commit
a81ab033ec
|
|
@ -4,7 +4,7 @@ autogenerated = 0
|
||||||
### MY PROGRAMS ###
|
### MY PROGRAMS ###
|
||||||
###################
|
###################
|
||||||
$terminal = footclient
|
$terminal = footclient
|
||||||
$menu = rofi -show run
|
$menu = fuzzel
|
||||||
$browser = zen-browser
|
$browser = zen-browser
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ bind = $mainMod SHIFT, P, pseudo, # dwindle
|
||||||
bind = $mainMod, J, togglesplit, # dwindle
|
bind = $mainMod, J, togglesplit, # dwindle
|
||||||
binde = $mainMod, tab, cyclenext, prev
|
binde = $mainMod, tab, cyclenext, prev
|
||||||
bind = $mainMod, b, exec, killall waybar || waybar
|
bind = $mainMod, b, exec, killall waybar || waybar
|
||||||
bind = $mainMod, grave, exec, rofiunicode
|
bind = $mainMod, grave, exec, fuzzelunicode
|
||||||
bind = $mainMod, escape, exec, sysact
|
bind = $mainMod, escape, exec, sysact
|
||||||
|
|
||||||
# Applications
|
# Applications
|
||||||
|
|
@ -283,8 +283,9 @@ bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@
|
||||||
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
||||||
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||||
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
||||||
bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
|
bindel = , XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/hypr_brightness.sh -
|
||||||
bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-
|
bindel = , XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/hypr_brightness.sh +
|
||||||
|
|
||||||
|
|
||||||
# Requires playerctl
|
# Requires playerctl
|
||||||
bindl = , XF86AudioNext, exec, playerctl next
|
bindl = , XF86AudioNext, exec, playerctl next
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
# Source: https://github.com/albertnis/hypr-brightness
|
||||||
|
# Install ddcutil, and then enable access to i2c for your user
|
||||||
|
|
||||||
|
# sudo gpasswd -a $USER i2c
|
||||||
|
# sudo modprobe i2c-dev
|
||||||
|
# echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf
|
||||||
|
|
||||||
|
set +e
|
||||||
|
|
||||||
|
usage="Usage: $0 [+] or [-]"
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "No direction parameter provided"
|
||||||
|
echo "$usage"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
arg="$1"
|
||||||
|
|
||||||
|
if [ "$arg" == "help" ] || [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
|
||||||
|
echo "$usage"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$arg" != "+" ] && [ "$arg" != "-" ]; then
|
||||||
|
echo "Direction parameter must be '+' or '-'"
|
||||||
|
echo $usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
direction=$arg
|
||||||
|
|
||||||
|
monitor_data=$(hyprctl monitors -j)
|
||||||
|
focused_name=$(echo $monitor_data | jq -r '.[] | select(.focused == true) | .name')
|
||||||
|
|
||||||
|
if [ "$focused_name" == "eDP-1" ]; then
|
||||||
|
if [ "$direction" == "-" ]; then
|
||||||
|
brightnessctl -e4 -n2 set 5%-
|
||||||
|
else
|
||||||
|
brightnessctl -e4 -n2 set 5%+
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
focused_id=$(echo $monitor_data | jq -r '.[] | select(.focused == true) | .id')
|
||||||
|
ddcutil --enable-dynamic-sleep --display=$focused_id setvcp 10 $direction 15
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue