From 03130ed9ee4c777402fbc06f81ab33a1e9aca47a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 9 May 2021 17:28:05 +0200 Subject: [PATCH] home: wm: i3: use 'brightnessctl' --- home/wm/i3.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/home/wm/i3.nix b/home/wm/i3.nix index 261a282..05c381d 100644 --- a/home/wm/i3.nix +++ b/home/wm/i3.nix @@ -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