Skip to content

Add fingerprint functionality via fprintd DBus service - #49

Open
quantum5 wants to merge 2 commits into
jirutka:masterfrom
quantum5:fingerprint
Open

Add fingerprint functionality via fprintd DBus service#49
quantum5 wants to merge 2 commits into
jirutka:masterfrom
quantum5:fingerprint

Conversation

@quantum5

@quantum5 quantum5 commented Nov 19, 2023

Copy link
Copy Markdown

For fun, I've ported swaywm#283 to run on this version of swaylock-effects. To enable fingerprint, build with -Dfingerprint=enabled.

@jirutka

jirutka commented Dec 1, 2023

Copy link
Copy Markdown
Owner

GitHub denied pushing into your branch, but allowed me to add commit via web interface. Weird.

ERROR: Permission to quantum5/swaylock-effects.git denied to jirutka.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists

@SebTM

SebTM commented Dec 5, 2023

Copy link
Copy Markdown

Would love to see this integrated into swaylock-effects and finally finding a home - otherwise you could have a look at this approach which would be sufficient to reach the same goal with some manual workarounds.

@quantum5

quantum5 commented Dec 6, 2023

Copy link
Copy Markdown
Author

Okay this should now build without fingerprint support. @jirutka is there anything else you want before merging?

@semi710

semi710 commented Dec 31, 2023

Copy link
Copy Markdown

@jirutka is this pr is in consideration?

@jirutka

jirutka commented Dec 31, 2023

Copy link
Copy Markdown
Owner

@jirutka is this pr is in consideration?

Yes, it is, I just need some time to test it.

@semi710

semi710 commented Jan 24, 2024

Copy link
Copy Markdown

@jirutka I have been using this pr and in my observation if it is build with fingerprint support then fingerprint works fine but manual password input fails to verify.

/etc/pam/swaylock

auth sufficient pam_fprintd.so
auth include login

after adding the pam_fprintd.so line in pam everything works fine.
it unlocks with password and fp both

@spikespaz

spikespaz commented Feb 6, 2024

Copy link
Copy Markdown

Why is this PR needed? It already works for me on NixOS (nixpkgs tracks this fork). I can press Enter and then grace the fingerprint sensor to log in, or I can just type the password and press Enter as normal.

$ cat /etc/pam.d/swaylock

auth sufficient pam_unix.so try_first_pass nullok
auth sufficient /nix/store/m0d04vgf83hmfck6njjiphn5px7i1hz6-fprintd-1.94.2/lib/security/pam_fprintd.so

Edit:

swaywm#283 (comment)

Hm, do we really all of this complexity? I'd rather not do any of the D-Bus stuff. Can't users leverage a PAM module which integrates with the fingerprint reader instead?

Yes, we want to check password and fingerprint in parallel. With Pam closest solution is check fingerprint after empty password was entered.

With this MR we can touch fingerprint scanner while PC is asleep, it will wake up over USB and immediately unlock without necessety to press any button.

@semi710

semi710 commented Feb 7, 2024

Copy link
Copy Markdown

Why is this PR needed? It already works for me on NixOS (nixpkgs tracks this fork). I can press Enter and then grace the fingerprint sensor to log in, or I can just type the password and press Enter as normal.

This pr enables to scan fingerprint without the press of the enter key.
Either you scan your finger or enter password and press enter. (Makes the experience a bit Clean)
For me after pressing enter and trying to put finger and if it fails the manually entering password also fails but this pr resolves that too for me.

@spikespaz

spikespaz commented Feb 7, 2024

Copy link
Copy Markdown

I don't know anything but would it be possible to use pkg-config to get the DBus interface?
systemd/systemd@1bd0cc4

Reason: PKG_CONFIG_DBUS_1_INTERFACES_DIR does not work in Nixpkgs.

Alternative:

postPatch = let
  dbusInterfacesDir = (pkgs.symlinkJoin {
    name = "${self.pname}-${self.version}_dbus-interfaces-dir";
    paths = self.buildInputs;
    pathsToLink = [ "share/dbus-1/interfaces" ];
  }) + "/share/dbus-1/interfaces";
in super.postPatch or "" + ''
  sed -i 's@/usr/share/dbus-1/interfaces@${dbusInterfacesDir}@g' \
    fingerprint/meson.build
'';

Comment thread completions/zsh/_swaylock
'(--hide-keyboard-layout -K)'{--hide-keyboard-layout,-K}'[Hide the current xkb layout while typing]' \
'(--ignore-empty-password -e)'{--ignore-empty-password,-e}'[When an empty password is provided, do not validate it]' \
'(--image -i)'{--image,-i}'[Display the given image, optionally only on the given output]:filename:_files' \
'(--fingerprint -p)'{--fingerprint,-p}'[Enable fingerprint scanning. Fprint is required]' \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Fprint/fprintd/

complete -c swaylock -l hide-keyboard-layout -s K --description "Hide the current xkb layout while typing."
complete -c swaylock -l ignore-empty-password -s e --description "When an empty password is provided, do not validate it."
complete -c swaylock -l image -s i --description "Display the given image, optionally only on the given output."
complete -c swaylock -l fingerprint p --description "Enable fingerprint scanning. Fprint is required."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Fprint/fprintd

Comment thread main.c
"Show the current Caps Lock state also on the indicator.\n"
#if HAVE_FINGERPRINT
" -p, --fingerprint "
"Enable fingerprint scanning. Fprint is required.\n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Fprint/fprintd

spikespaz added a commit to spikespaz/dotfiles that referenced this pull request Feb 9, 2024
@spikespaz

Copy link
Copy Markdown

It doesn't work when resuming from hibernation, works for suspend. Can anyone reproduce?

spikespaz added a commit to spikespaz/dotfiles that referenced this pull request Apr 24, 2024
hboetes pushed a commit to hboetes/swaylock-effects that referenced this pull request Mar 6, 2026
Cherry-picked from jirutka#49
Co-authored-by: Quantum <quantum2048@gmail.com>
@hboetes

hboetes commented Mar 11, 2026

Copy link
Copy Markdown

To make it official, I forked this repo and applied this excellent feature: hboetes@6b47471

Together with further improvement, bug fixes, security fixes and other excellent PRs never committed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants