From c437c7860ac0f0b4440cea7e56a1c0a2e413db27 Mon Sep 17 00:00:00 2001 From: q3aql Date: Mon, 27 Jun 2022 19:06:56 +0200 Subject: [PATCH] Run curses interface when X11/Wayland fail (pwsh-vault) --- pwsh-vault.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pwsh-vault.sh b/pwsh-vault.sh index 3c7adc2..c667b9f 100755 --- a/pwsh-vault.sh +++ b/pwsh-vault.sh @@ -1263,6 +1263,28 @@ function pwsh_vault_main() { 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 mkdir -p ${pwsh_vault} mkdir -p ${pwsh_vault}/notes @@ -1295,6 +1317,7 @@ elif [ "${1}" == "--gen-password" ] ; then generate_password "${2}" "param" fi else + check_output_display init_masterkey pwsh_vault_main fi