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
|
@ -5,7 +5,7 @@
|
||||||
./disk-config.nix
|
./disk-config.nix
|
||||||
../../hardware/base.nix
|
../../hardware/base.nix
|
||||||
../../hardware/bluetooth.nix
|
../../hardware/bluetooth.nix
|
||||||
../../system/desktop.nix
|
../../system/laptop.nix
|
||||||
../../system/printing/home.nix
|
../../system/printing/home.nix
|
||||||
../../desktop
|
../../desktop
|
||||||
../../desktop/cosmic.nix
|
../../desktop/cosmic.nix
|
||||||
|
|
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