Selaa lähdekoodia

keyboard and display background now via notification

Noah Vogt 1 päivä sitten
vanhempi
sitoutus
c0e3ef4b78

+ 4 - 2
dot-config/hypr/hyprland.conf

@@ -334,8 +334,10 @@ 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 = ,XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/brightness.sh 5%+
-bindel = ,XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/brightness.sh 5%-
+bindel = ,XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/display-brightness.sh 5%+
+bindel = ,XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/display-brightness.sh 5%-
+bindel = $mainMod, XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/keyboard-brightness.sh 5%+
+bindel = $mainMod, XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/keyboard-brightness.sh 5%-
 
 # Requires playerctl
 bindl = , XF86AudioNext, exec, playerctl next

+ 2 - 1
dot-config/hypr/scripts/brightness.sh → dot-config/hypr/scripts/display-brightness.sh

@@ -1,6 +1,7 @@
 #!/bin/sh
 
-# Apply the brightness change passed as an argument (e.g., 5%+ or 5%-)
+# script to set the display backlight brightness by the passed amount ($1)
+
 brightnessctl -e4 -n2 set "$1"
 
 PERCENT=$(brightnessctl -m | awk -F, '{print $4}' | tr -d '%')

+ 16 - 0
dot-config/hypr/scripts/keyboard-brightness.sh

@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# script to set the keyboard backlight brightness by the passed amount ($1)
+
+device=$(brightnessctl -l | grep "kbd_backlight" | head -n 1 | awk '{print $2}' | tr -d "'")
+brightnessctl -d "$device" set "$1"
+
+PERCENT=$(brightnessctl -m -d "$device" | awk -F, '{print $4}' | tr -d '%')
+
+notify-send -i keyboard-brightness-symbolic \
+    -h int:transient:1 \
+    -h int:SWAYNC_BYPASS_DND:1 \
+    -h string:x-canonical-private-synchronous:brightness \
+    -h int:value:"$PERCENT" \
+    -t 1500 \
+    "Brightness: ${PERCENT}%"