From 46c5bf255206c88434692f7d91c6fa92ffb7417e Mon Sep 17 00:00:00 2001 From: krolxon Date: Tue, 26 Aug 2025 01:00:50 +0530 Subject: move hypr_brightness to \$PATH --- .config/hypr/hyprland.conf | 4 +-- .config/hypr/scripts/hypr_brightness.sh | 46 --------------------------------- .local/bin/brictl | 46 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 48 deletions(-) delete mode 100755 .config/hypr/scripts/hypr_brightness.sh create mode 100755 .local/bin/brictl diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index d12c614..a8c7d1e 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -283,8 +283,8 @@ bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindel = , XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/hypr_brightness.sh - -bindel = , XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/hypr_brightness.sh + +bindel = , XF86MonBrightnessDown, exec, ~/.local/bin/brictl - +bindel = , XF86MonBrightnessUp, exec, ~/.local/bin/brictl + # Requires playerctl diff --git a/.config/hypr/scripts/hypr_brightness.sh b/.config/hypr/scripts/hypr_brightness.sh deleted file mode 100755 index 2ba9d98..0000000 --- a/.config/hypr/scripts/hypr_brightness.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/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 diff --git a/.local/bin/brictl b/.local/bin/brictl new file mode 100755 index 0000000..2ba9d98 --- /dev/null +++ b/.local/bin/brictl @@ -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 -- cgit v1.2.3