Run curses interface when X11/Wayland fail (pwsh-vault)

This commit is contained in:
q3aql 2022-06-27 19:06:56 +02:00
parent 836a70f421
commit c437c7860a

View File

@ -1263,6 +1263,28 @@ function pwsh_vault_main() {
done done
} }
function check_output_display() {
if [ -f /usr/bin/pwsh-vaultm ] ; then
display=0
if [ -z "${XDG_SESSION_TYPE}" ] ; then
display=1
elif [ "${XDG_SESSION_TYPE}" == "tty" ] ; then
display=1
elif [ "${XDG_SESSION_TYPE}" == "x11" ] ; then
display=0
elif [ "${XDG_SESSION_TYPE}" == "wayland" ] ; then
display=0
fi
if [ "${display}" == "1" ] ; then
pwsh-vault-dl
exit
fi
else
pwsh-vault-dl
exit
fi
}
# Create directories & run script # Create directories & run script
mkdir -p ${pwsh_vault} mkdir -p ${pwsh_vault}
mkdir -p ${pwsh_vault}/notes mkdir -p ${pwsh_vault}/notes
@ -1295,6 +1317,7 @@ elif [ "${1}" == "--gen-password" ] ; then
generate_password "${2}" "param" generate_password "${2}" "param"
fi fi
else else
check_output_display
init_masterkey init_masterkey
pwsh_vault_main pwsh_vault_main
fi fi