home: wm: i3: use 'brightnessctl'

This commit is contained in:
Bruno BELANYI 2021-05-09 17:28:05 +02:00
parent 27c11b9b67
commit 62ac22a8c5

View file

@ -222,20 +222,19 @@ in
} }
( (
let let
xbacklight = "${pkgs.xorg.xbacklight}/bin/xbacklight"; brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
changeBacklight = pkgs.writeScript "change-backlight" '' changeBacklight = pkgs.writeScript "change-backlight" ''
#!/bin/sh #!/bin/sh
if [ "$1" = "up" ]; then if [ "$1" = "up" ]; then
upDown=-inc upDown="+$2%"
else else
upDown=-dec upDown="$2%-"
fi fi
${xbacklight} "$upDown" "$2" newBrightness="$(${brightnessctl} -m set "$upDown" | cut -d, -f4)"
newBrightness="$(printf '$.0f' "$(${xbacklight} -get)")"
${pkgs.libnotify}/bin/notify-send -u low \ ${pkgs.libnotify}/bin/notify-send -u low \
-h string:x-canonical-private-synchronous:change-backlight \ -h string:x-canonical-private-synchronous:change-backlight \
-h "int:value:$newBrightness" \ -h "int:value:''${newBrightness/\%/}" \
-- "Set brightness to $newBrightness" -- "Set brightness to $newBrightness"
''; '';
in in