From f28e934cd08fe1d3eb5daae191ff2549479bf103 Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Wed, 7 Sep 2022 10:58:54 +0200 Subject: [PATCH] Better xidlehook + screen shutdown --- hm_modules/xidlehook.nix | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/hm_modules/xidlehook.nix b/hm_modules/xidlehook.nix index f0b11c9..8105c9d 100644 --- a/hm_modules/xidlehook.nix +++ b/hm_modules/xidlehook.nix @@ -4,32 +4,46 @@ with lib; let xbacklightCmd = "${pkgs.xorg.xbacklight}/bin/xbacklight"; - package = pkgs.writeScriptBin "xidlehook" '' - ${pkgs.xidlehook}/bin/xidlehook --detect-sleep "$@" - ''; + xsetCmd = "${pkgs.xorg.xset}/bin/xset"; lightLevel = 10; - saveLightLevel = "${xbacklightCmd} -get > /run/user/$UID/xbacklight_v"; - lowerLight = "${xbacklightCmd} -set ${toString lightLevel}"; - resetLight = - "${xbacklightCmd} -set $( /run/user/$UID/xbacklight_v + ''; + lowerLight = pkgs.writeShellScript "lower_light" '' + ${xbacklightCmd} -set ${toString lightLevel} + ''; + resetLight = pkgs.writeShellScript "reset_light" '' + ${xbacklightCmd} -set $(