diff --git a/bin/omarchy-fingerprint-setup b/bin/omarchy-fingerprint-setup index d23a0fc..0a7e09a 100755 --- a/bin/omarchy-fingerprint-setup +++ b/bin/omarchy-fingerprint-setup @@ -1,20 +1,38 @@ #!/bin/bash -yay -S --noconfirm --needed fprintd libfprint +yay -S --noconfirm --needed fprintd libfprint lsusb -# Add fingerprint authentication as a sufficient option -grep -q 'pam_fprintd.so' /etc/pam.d/system-auth || - sudo sed -i '/^auth.*pam_unix.so/ i auth sufficient pam_fprintd.so' /etc/pam.d/system-auth -systemctl --user restart hyprpolkitagent - -# Enroll the first finger -echo -e "\e[32m\nLet's setup your right index finger as the first fingerprint.\nKeep moving the finger around on sensor until the process completes.\n\e[0m" -sudo fprintd-enroll $USER - -echo -e "\e[32m\nNow let's verify that it's working correctly.\e[0m\n" - -if fprintd-verify; then - echo -e "\e[32m\nPerfect! Now you can use your fingerprint on the lock screen (Super + Escape).\e[0m" +if ! lsusb | grep -iq fingerprint; then + echo -e "\e[31m\nNo fingerprint sensor detected.\e[0m" else - echo -e "\e[31m\nSomething went wrong. Maybe try again?\e[0m" + # Add fingerprint authentication as an option for sudo + if ! grep -q pam_fprintd.so /etc/pam.d/sudo; then + sudo sed -i '1i auth sufficient pam_fprintd.so' /etc/pam.d/sudo + fi + + # Add fingerprint authentication as an option for hyprpolkitagent + if [ ! -f /etc/pam.d/polkit-1 ] || ! grep -q pam_fprintd.so /etc/pam.d/polkit-1; then + sudo tee /etc/pam.d/polkit-1 >/dev/null <<'EOF' +auth required pam_unix.so +auth optional pam_fprintd.so + +account required pam_unix.so +password required pam_unix.so +session required pam_unix.so +EOF + fi + + systemctl --user restart hyprpolkitagent + + # Enroll the first finger + echo -e "\e[32m\nLet's setup your right index finger as the first fingerprint.\nKeep moving the finger around on sensor until the process completes.\n\e[0m" + sudo fprintd-enroll $USER + + echo -e "\e[32m\nNow let's verify that it's working correctly.\e[0m\n" + + if fprintd-verify; then + echo -e "\e[32m\nPerfect! Now you can use your fingerprint on the lock screen (Super + Escape).\e[0m" + else + echo -e "\e[31m\nSomething went wrong. Maybe try again?\e[0m" + fi fi diff --git a/default/hypr/autostart.conf b/default/hypr/autostart.conf index 089f64a..4bc01c3 100644 --- a/default/hypr/autostart.conf +++ b/default/hypr/autostart.conf @@ -1,4 +1,4 @@ exec-once = hypridle & mako & waybar & fcitx5 exec-once = swaybg -i ~/.config/omarchy/current/background -m fill -exec-once = systemctl --user start hyprpolkitagent +exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once = wl-clip-persist --clipboard regular diff --git a/install/hyprlandia.sh b/install/hyprlandia.sh index a320d9d..a7e0c3b 100644 --- a/install/hyprlandia.sh +++ b/install/hyprlandia.sh @@ -1,5 +1,5 @@ yay -S --noconfirm --needed \ - hyprland hyprshot hyprpicker hyprlock hypridle hyprpolkitagent hyprland-qtutils \ + hyprland hyprshot hyprpicker hyprlock hypridle polkit-gnome hyprland-qtutils \ wofi waybar mako swaybg \ xdg-desktop-portal-hyprland xdg-desktop-portal-gtk diff --git a/migrations/1752104271.sh b/migrations/1752104271.sh new file mode 100644 index 0000000..b00e99a --- /dev/null +++ b/migrations/1752104271.sh @@ -0,0 +1,8 @@ +echo "Switching to polkit-gnome for better fingerprint authentication compatibility" +if ! command -v /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &>/dev/null; then + yay -S --noconfirm --needed polkit-gnome + systemctl --user stop hyprpolkitagent + systemctl --user disable hyprpolkitagent + yay -Rns --noconfirm hyprpolkitagent + setsid /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & +fi