From ffdc0f664f77c25bd82b935d8c439bd0ceed6d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Wi=C3=9Fmann?= Date: Sat, 5 Dec 2015 12:26:14 +0100 Subject: [PATCH] Ask for confirmation on fuzzy entry matching --- misc/userscripts/password_fill | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/misc/userscripts/password_fill b/misc/userscripts/password_fill index 7ce989902..2a5c21792 100755 --- a/misc/userscripts/password_fill +++ b/misc/userscripts/password_fill @@ -19,7 +19,10 @@ Behaviour: It will try to find a username/password entry in the configured backend (currently only pass) for the current website and will load that pair of username and password to any form on the current page that has some password - entry field. + entry field. If multiple entries are found, a zenity menu is offered. + + If no entry is found, then it crops subdomains from the url if at least one + entry is found in the backend. (In that case, it always shows a menu) EOF } @@ -92,6 +95,8 @@ no_entries_found() { simple_url=$(sed 's,^[^.]*\.,,' <<< "$simple_url") query_entries "$simple_url" #die "No entry found for »$simple_url«" + # enforce menu if we do "fuzzy" matching + menu_if_one_entry=1 done if [ 0 -eq "${#files[@]}" ] ; then die "No entry found for »$simple_url«" @@ -140,9 +145,11 @@ choose_entry_random() { # dmenu or zenity or even qutebrowser completion in future?) which entry to # pick MENU_COMMAND=( head -n 1 ) +# whether to show the menu if there is only one entrie in it +menu_if_one_entry=0 choose_entry_menu() { local nr=${#files[@]} - if [ "$nr" -eq 1 ] ; then + if [ "$nr" -eq 1 ] && ! ((menu_if_one_entry)) ; then file="${files[0]}" else file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )