diff --git a/src/help.sh b/src/help.sh index ef09d59..9c28e9a 100644 --- a/src/help.sh +++ b/src/help.sh @@ -43,6 +43,7 @@ usage() ZPASS_SSH_ID SSH private key to use for scp/sftp ZPASS_REMOTE_USER User for login ZPASS_REMOTE_PASSWORD Password for ftps/webdav login. Not for SSH + ZPASS_PRIORITIZE_CLI Key prompt will always be done on CLI if stdin is a tty All operations can be shortened to their first char unless specified Unknown first argument will perform the operation described in 'ZPASS_UNK_OP_CALL' on that argument diff --git a/src/prompt.sh b/src/prompt.sh index 4b9a70e..8c66efa 100644 --- a/src/prompt.sh +++ b/src/prompt.sh @@ -15,9 +15,13 @@ console_prompt_hidden() ) } +is_graphical() { + [ -n "$DISPLAY" ] && { [ -z "$ZPASS_PRIORITIZE_CLI" ] || ! [ -t 0 ] ; } +} + # $1 = prompt message prompt_password() { - if [ -n "$DISPLAY" ] + if is_graphical then if which kdialog >/dev/null 2>&2 then kdialog --title "$fname" --password "$1" 2>/dev/null