From c8116f19b3393405ae707461663abdd813e59746 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Sat, 30 May 2015 11:02:34 +0200 Subject: [PATCH] add possiblity to define root folder --- rofi-pass | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rofi-pass b/rofi-pass index 768b5be..77a3ac0 100755 --- a/rofi-pass +++ b/rofi-pass @@ -19,10 +19,14 @@ if [[ -z $BROWSER ]]; then export BROWSER=xdg-open fi -if [[ $(find "$basedir" -maxdepth 1 \( ! -name '.*' \) -type d | wc -l) == "1" ]]; then - root="$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \;)" +if [[ -n "$root" ]]; then + root="$root" else - root=$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \; | rofi -dmenu -p "Choose Database") + if [[ $(find "$basedir" -maxdepth 1 \( ! -name '.*' \) -type d | wc -l) == "1" ]]; then + root="$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \;)" + else + root=$(find "${basedir}" -maxdepth 1 \( ! -name '.*' \) -type d -exec basename {} \; | rofi -dmenu -p "Choose Database") + fi fi list_passwords() { @@ -74,6 +78,8 @@ Alt+4: Open URL | Alt+5: Show/Edit" globalMenu elif [[ "$selected_password" == "[ Add Entry ]" ]]; then insertPass + elif [[ "$selected_password" == "" ]]; then + exit fi password_temp=$(pass "$selected_password")