diff --git a/hosts/cmdframe/default.nix b/hosts/cmdframe/default.nix index e1750c8..f122a4b 100644 --- a/hosts/cmdframe/default.nix +++ b/hosts/cmdframe/default.nix @@ -5,7 +5,7 @@ ./disk-config.nix ../../hardware/base.nix ../../hardware/bluetooth.nix - ../../system/desktop.nix + ../../system/laptop.nix ../../system/printing/home.nix ../../desktop ../../desktop/cosmic.nix diff --git a/system/laptop.nix b/system/laptop.nix new file mode 100644 index 0000000..74eeef9 --- /dev/null +++ b/system/laptop.nix @@ -0,0 +1,8 @@ +_: + +{ + imports = [ + ./desktop.nix + ./lid.nix + ]; +} diff --git a/system/lid.nix b/system/lid.nix new file mode 100644 index 0000000..ccdc5c9 --- /dev/null +++ b/system/lid.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: + +{ + services.acpid = lib.mkIf config.services.fprintd.enable { + enable = true; + handlers.lidClosed = { + event = "button/lid \\w+ close"; + action = '' + echo "Lid closed. Disabling fprintd." + systemctl stop fprintd + ln -s /dev/null /run/systemd/transient/fprintd.service + systemctl daemon-reload + ''; + }; + handlers.lidOpen = { + event = "button/lid \\w+ open"; + action = '' + if ! $(systemctl is-active --quiet fprintd); then + echo "Lid open. Enabling fprintd." + rm -f /run/systemd/transient/fprintd.service + systemctl daemon-reload + systemctl start fprintd + fi + ''; + }; + }; +}