feat(system): enable fingerprint reader only if lid is open
This commit is contained in:
parent
77f0ba6d03
commit
18674ac22d
3 changed files with 36 additions and 1 deletions
8
system/laptop.nix
Normal file
8
system/laptop.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
_:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./desktop.nix
|
||||
./lid.nix
|
||||
];
|
||||
}
|
27
system/lid.nix
Normal file
27
system/lid.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue