fix pinentry selector in pkgs

This commit is contained in:
ulic-youthlic 2025-01-15 22:56:52 +08:00
parent 3e1a92bac0
commit 597844c60c
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721

View file

@ -5,18 +5,21 @@ pkgs.writeShellApplication {
pinentry-all
];
text = ''
case $(tty) in
/dev/tty[1-9])
pinentry-curses;;
/dev/pts/*)
if [ -v SSH_CLIENT ] && [ -n "$SSH_CLIENT" ]; then
pinentry-curses
else
pinentry-qt
fi
;;
*)
pinentry-curses;;
esac
if [ -v XDG_SESSION_TYPE ]; then
case $XDG_SESSION_TYPE in
tty)
pinentry-tty;;
*)
pinentry-qt;;
esac
elif [ -v SSH_CLIENT ] && [ -n "$SSH_CLIENT" ]; then
pinentry-tty
elif [ -v WAYLAND_DISPLAY ] && [ -n "$WAYLAND_DISPLAY" ]; then
pinentry-qt
elif [ -v DISPLAY ] && [ -n "$DISPLAY" ]; then
pinentry-qt
else
pinentry-tty
fi
'';
}