Respect default_do config setting and allow "menu" value. Fixes #52

This commit is contained in:
Rasmus Steinke 2016-08-05 04:16:30 +02:00
parent ca70a0e777
commit 5083c181fd
2 changed files with 25 additions and 17 deletions

View File

@ -26,7 +26,7 @@ BROWSER='chromium'
## Misc settings ## Misc settings
default_do='autopass' # copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl default_do='menu' # menu, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
auto_enter='false' auto_enter='false'
notify='false' notify='false'
passlength='20' passlength='20'

View File

@ -13,7 +13,7 @@ URL_field='url'
USERNAME_field='user' USERNAME_field='user'
AUTOTYPE_field='autotype' AUTOTYPE_field='autotype'
delay=2 delay=2
default_do='autopass' # copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl default_do='menu' # menu, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
auto_enter='false' auto_enter='false'
notify='false' notify='false'
passlength='20' passlength='20'
@ -324,22 +324,30 @@ else unset helptext; mainMenu; fi
} }
typeMenu () { typeMenu () {
checkIfPass clear
typefield=$(printf '%s\n' "${!stuff[@]}" | sort | _rofi -kb-accept-entry '!Return' -dmenu -p "Choose Field to type > ") echo "${default_do}"
val=$? if [[ -n $default_do ]]; then
if [[ $val -eq 1 ]]; then if [[ $default_do == "menu" ]]; then
exit checkIfPass
typefield=$(printf '%s\n' "${!stuff[@]}" | sort | _rofi -kb-accept-entry '!Return' -dmenu -p "Choose Field to type > ")
val=$?
if [[ $val -eq 1 ]]; then
exit
fi
if [[ $typefield == "" ]]; then
exit;
elif [[ $typefield == "password" ]]; then
typePass
elif [[ $typefield == "${AUTOTYPE_field}" ]]; then
autopass
else
typeField
fi
clearUp
else
$(${default_do})
fi
fi fi
if [[ $typefield == "" ]]; then
exit;
elif [[ $typefield == "password" ]]; then
typePass
elif [[ $typefield == "${AUTOTYPE_field}" ]]; then
autopass
else
typeField
fi
clearUp
} }
copyMenu () { copyMenu () {