feat(system): enable fingerprint reader only if lid is open

This commit is contained in:
Felix Schröter 2025-07-17 13:54:51 +02:00
parent 77f0ba6d03
commit 18674ac22d
Signed by: felschr
GPG key ID: 671E39E6744C807D
3 changed files with 36 additions and 1 deletions

8
system/laptop.nix Normal file
View file

@ -0,0 +1,8 @@
_:
{
imports = [
./desktop.nix
./lid.nix
];
}

27
system/lid.nix Normal file
View file

@ -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
'';
};
};
}