add fingerprint auto-shutoff on lid close to docs

This commit is contained in:
ducoterra
2023-08-02 09:50:22 -04:00
parent c50669c878
commit 83a4a59cc8

95
arch.md
View File

@@ -192,10 +192,101 @@ sudo ufw enable
```conf
# fingerprint auth
auth sufficient pam_unix.so try_first_pass likeauth nullok
auth sufficient pam_fprintd.so
auth sufficient pam_fprintd.so
```
sudo vim /etc/pam.d/system-auth and at the top of the file:
```conf
# fingerprint auth
auth sufficient pam_fprintd.so
```
**Turn Off Fingerprint When Laptop Lid Closed**
To disable fingerprint authentication when the laptop lid is closed, and
re-enable when it is reopened, we will use acpid to bind to the button/lid.*
event to a custom script that will stop and mask the fprintd service on lid
close, and unmask and start the fprintd service on lid open.
We also check that the HDMI cable is connected by testing the contents of
/sys/class/drm/card0-HDMI-A-1/status.
Follow the steps below:
1. `pacman -S acpid` and then `systemctl enable --now acpid`
1. Create a .locks file in your home dir: `mkdir ~/.locks`
2. Create file /etc/acpi/laptop-lid.sh with the following contents:
```bash
#!/bin/bash
lock=/home/ducoterra/.locks/fprint-disabled.lock
if grep -Fq closed /proc/acpi/button/lid/LID0/state # &&
# This is used to detect if a display is connected.
# For USB C displayport use:
# grep -Fxq connected /sys/class/drm/card1-DP-2/status
# For hdmi use:
# grep -Fxq connected /sys/class/drm/card0-HDMI-A-1/status
then
touch "$lock"
systemctl stop fprintd
systemctl mask fprintd
elif [ -f "$lock" ]
then
systemctl unmask fprintd
systemctl start fprintd
rm -f "$lock"
fi
```
3. Make the file executable with
`chmod +x /etc/acpi/laptop-lid.sh`
4. Create file /etc/acpi/events/laptop-lid with the following contents:
```bash
event=button/lid.*
action=/etc/acpi/laptop-lid.sh
```
5. Restart the acpid service with:
`systemctl restart acpid`
Now the fingerprint will be used only when the lid is open.
In order to restore the correct state of the fprintd service if you
disconnect/reconnect while the laptop is off, you may call the above script
from a systemd init file. The steps to do this are the following:
1. Create a file named /etc/systemd/system/laptop-lid.service with the following contents:
```bash
[Unit]
Description=Laptop Lid
After=suspend.target
[Service]
ExecStart=/etc/acpi/laptop-lid.sh
[Install]
WantedBy=multi-user.target
WantedBy=suspend.target
```
2. Reload the systemd config files with
`sudo systemctl daemon-reload`
3. Start and enable the service with
`sudo systemctl enable --now laptop-lid.service`
Now the status should be correct even after connecting/disconnecting when the computer is off.
### AppImage Support
fuse is required to run most appimages.