Fix brightness script

This commit is contained in:
DashieTM 2025-03-15 15:45:11 +01:00
parent 4f04b5d683
commit 5443370f16
2 changed files with 3 additions and 9 deletions

View file

@ -164,8 +164,8 @@ in {
",XF86AudioPlay,exec, playerctl play-pause" ",XF86AudioPlay,exec, playerctl play-pause"
",XF86AudioNext,exec, playerctl next" ",XF86AudioNext,exec, playerctl next"
",XF86AudioPrev,exec, playerctl previous" ",XF86AudioPrev,exec, playerctl previous"
(lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, change-brightness brightness 10%-") (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, changeBrightness brightness 10%-")
(lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, change-brightness brightness +10%") (lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, changeBrightness brightness +10%")
# hyprland keybinds # hyprland keybinds
# misc # misc

View file

@ -30,15 +30,9 @@
[ [
(lib.mkIf config.mods.scripts.changeBrightness ( (lib.mkIf config.mods.scripts.changeBrightness (
pkgs.writeShellScriptBin "changeBrightness" '' pkgs.writeShellScriptBin "changeBrightness" ''
set_brightness() {
brightnessctl set "$1" brightnessctl set "$1"
CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}') CURRENT=$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}')
dunstify -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%" notify-send -a "changeBrightness" -r 3 -u low -i brightness-high -h int:value:"$CURRENT" "Brightness: ''${CURRENT}%"
}
if [ "$1" == "brightness" ]; then
set_brightness "$2"
fi
'' ''
)) ))
(lib.mkIf config.mods.scripts.audioControl ( (lib.mkIf config.mods.scripts.audioControl (