summaryrefslogtreecommitdiffstats
path: root/modules/lidControl.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lidControl.nix')
-rw-r--r--modules/lidControl.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/lidControl.nix b/modules/lidControl.nix
index 38f0a0f..dc2f8d1 100644
--- a/modules/lidControl.nix
+++ b/modules/lidControl.nix
@@ -7,7 +7,7 @@
in lib.mkIf cfg.enable {
services.acpid.enable = true;
services.acpid.lidEventCommands = /* sh */ ''
- set -- $1
+ lid_state=$(${pkgs.gawk}/bin/awk '{print$2}' /proc/acpi/button/lid/*/state)
# usage: vt_is_xserver NUMBER
vt_is_xserver() {
@@ -27,20 +27,20 @@
--uid=$owner \
"$@"
}
- case $3 in
+ case $lid_state in
open)
run_on_display ${pkgs.xorg.xset}/bin/xset dpms force on
;;
- close)
+ closed)
run_on_display ${pkgs.xorg.xset}/bin/xset dpms force off
;;
esac
else
- case $3 in
+ case $lid_state in
open)
${pkgs.brightnessctl}/bin/brightnessctl --restore >/dev/null 2>&1
;;
- close)
+ closed)
${pkgs.brightnessctl}/bin/brightnessctl --save >/dev/null 2>&1
${pkgs.brightnessctl}/bin/brightnessctl --quiet set 0
;;