home: wm: i3: use 'brightnessctl'

This commit is contained in:
Bruno BELANYI 2021-05-09 17:28:05 +02:00
parent ac4cf0c1a2
commit 03130ed9ee

View file

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