dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

commit 49bfe1566a8994e0ed3cae9b61d2f0cb48f17baf
parent 7722de2a055347ab810144ddb09930f36ccf0511
Author: Chris <chris@echoz.io>
Date:   Tue,  7 Oct 2025 11:17:53 +0200

fix: use brightness device in all brightness-related listeneres

Diffstat:
Mhosts/rc/default.nix | 7++++++-
Mmodules/hypr/hypridle.nix | 61+++++++++++++++++++++++++++++++++----------------------------
2 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/hosts/rc/default.nix b/hosts/rc/default.nix @@ -1,4 +1,9 @@ -{ modulesPath, sec, user, ... }: +{ + modulesPath, + sec, + user, + ... +}: { imports = [ sec.nixosModules.dot diff --git a/modules/hypr/hypridle.nix b/modules/hypr/hypridle.nix @@ -69,34 +69,39 @@ ); } ] - ++ (lib.optionals (cfg.brightnessDevice != null) [ - { - timeout = 1; - on-resume = builtins.toString ( - pkgs.writeShellScript "undim" '' - brightnessctl -d ${lib.escapeShellArg cfg.brightnessDevice} -r - '' - ); - } - { - timeout = 10; - on-timeout = builtins.toString ( - pkgs.writeShellScript "manual-lock-dim" '' - save="$(brightnessctl -m | awk -F, '{if ($4 != "10%") {print "-s"; exit}}')" - pidof hyprlock && brightnessctl $save set 10% - '' - ); - } - { - timeout = 60; - on-timeout = builtins.toString ( - pkgs.writeShellScript "auto-dim" '' - save="$(brightnessctl -m | awk -F, '{if ($4 != "10%") {print "-s"; exit}}')" - brightnessctl $save set 10% - '' - ); - } - ]); + ++ (lib.optionals (cfg.brightnessDevice != null) ( + let + dev = lib.escapeShellArg cfg.brightnessDevice; + in + [ + { + timeout = 1; + on-resume = builtins.toString ( + pkgs.writeShellScript "undim" '' + brightnessctl -d ${dev} -r + '' + ); + } + { + timeout = 10; + on-timeout = builtins.toString ( + pkgs.writeShellScript "manual-lock-dim" '' + save="$(brightnessctl -d ${dev} -m | awk -F, '{if ($4 != "10%") {print "-s"; exit}}')" + pidof hyprlock && brightnessctl -d ${dev} $save set 10% + '' + ); + } + { + timeout = 60; + on-timeout = builtins.toString ( + pkgs.writeShellScript "auto-dim" '' + save="$(brightnessctl -d ${dev} -m | awk -F, '{if ($4 != "10%") {print "-s"; exit}}')" + brightnessctl -d ${dev} $save set 10% + '' + ); + } + ] + )); }; }; };