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 pinentry-all
]; ];
text = '' text = ''
case $(tty) in if [ -v XDG_SESSION_TYPE ]; then
/dev/tty[1-9]) case $XDG_SESSION_TYPE in
pinentry-curses;; tty)
/dev/pts/*) pinentry-tty;;
if [ -v SSH_CLIENT ] && [ -n "$SSH_CLIENT" ]; then
pinentry-curses
else
pinentry-qt
fi
;;
*) *)
pinentry-curses;; pinentry-qt;;
esac 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
''; '';
} }