From e3e6ceb7c51ac1d1a9081c9720f63ae1f86fb42b Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Wed, 5 Aug 2015 07:59:38 +0200 Subject: [PATCH] re-open list when opening URL. This allows to directly enter passowrd after clicking the input field --- rofi-pass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rofi-pass b/rofi-pass index 362ec70..d55c89b 100755 --- a/rofi-pass +++ b/rofi-pass @@ -58,9 +58,17 @@ xdotool_type() { mainMenu () { HELP="${autotype}: Autotype | ${type_user}: Type User | ${type_pass}: Type Password ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Password | ${show}: Show Entry" - selected_password="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | rofi -i -mesg "${HELP}" -dmenu -kb-custom-1 "${autotype}" -kb-custom-2 "${type_user}" -kb-custom-3 "${type_pass}" -kb-custom-4 "${open_url}" -kb-custom-5 "${copy_name}" -kb-custom-6 "${copy_pass}" -kb-custom-7 "${show}" -dmenu -select "$entry" -p "rofi-pass > ")" + selected_password_temp="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | rofi -i -mesg "${HELP}" -dmenu -kb-custom-1 "${autotype}" -kb-custom-2 "${type_user}" -kb-custom-3 "${type_pass}" -kb-custom-4 "${open_url}" -kb-custom-5 "${copy_name}" -kb-custom-6 "${copy_pass}" -kb-custom-7 "${show}" -dmenu -select "$entry" -format "f¬s" -filter "$filter" -p "rofi-pass > ")" rofi_exit=$? - if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "URL: " | awk -F 'URL: ' '{ print $2 }')"; exit; + + selected_password="${selected_password_temp#*¬}" + unset filter + filter="${selected_password_temp%¬*}" + + rm -f "$HOME/.config/rofi-pass/last_used" + echo "$selected_password" > "$HOME/.config/rofi-pass/last_used" + + if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "URL: " | awk -F 'URL: ' '{ print $2 }')"; export entry="${selected_password}"; export filter="${filter}"; mainMenu elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit}; elif [[ "${rofi_exit}" -eq 10 || "${rofi-exit}" -eq 0 ]]; then true fi