change defaults. Enter shows menu with fields to type now. Hotkeys 1-3 remain (autotype, type user, type password)

This commit is contained in:
Rasmus Steinke 2016-07-26 01:01:33 +02:00
parent 27d4b80431
commit 38e02922e1

View File

@ -41,11 +41,6 @@ checkIfPass () {
autopass () {
if [[ ${selected_password} == "[ Add Entry ]>" ]]; then
insertPass;
elif [[ ${selected_password} == "---" ]]; then
mainMenu;
else
rm -f "$HOME/.cache/rofi-pass/last_used"
echo "${root}: $selected_password" > "$HOME/.cache/rofi-pass/last_used"
chmod 600 "$HOME/.cache/rofi-pass/last_used"
@ -80,7 +75,6 @@ autopass () {
xdotool key Return
fi
fi
fi
}
openURL () {
@ -217,9 +211,6 @@ To perform default action use <span color='$help_color'>Enter</span>. For more h
rofi_exit=$?
if [[ ${selected_password} == "[ Add Entry ]>" ]]; then
:
else
# generate Array of fields
password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password")
password=$(echo "${password_temp}" | head -1)
@ -231,15 +222,21 @@ To perform default action use <span color='$help_color'>Enter</span>. For more h
done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | grep -P '(: |:\t)' )
stuff["pass"]=${password}
fi
if test "${stuff['autotype']+autotype}"
then
:
else
stuff["autotype"]="user :tab pass"
fi;
# actions based on keypresses
if [[ "${rofi_exit}" -eq 0 ]]; then ${default_do};
if [[ "${rofi_exit}" -eq 0 ]]; then typeMenu;
elif [[ "${rofi_exit}" -eq 13 ]]; then openURL;
elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit};
elif [[ "${rofi_exit}" -eq 10 ]]; then autopass;
elif [[ "${rofi_exit}" -eq 14 ]]; then copyMenu;
elif [[ "${rofi_exit}" -eq 11 ]]; then typeUser;
elif [[ "${rofi_exit}" -eq 12 ]]; then typePass;
elif [[ "${rofi_exit}" -eq 14 ]]; then copyUser;
elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL;
elif [[ "${rofi_exit}" -eq 16 ]]; then viewEntry;
elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass;
@ -257,7 +254,6 @@ To perform default action use <span color='$help_color'>Enter</span>. For more h
unset selected_password
unset password_temp
unset stuff
fi
}
helpMenu () {
@ -283,19 +279,17 @@ else unset helptext; mainMenu; fi
typeMenu () {
checkIfPass
typefield=$({ echo -e "< Return\n---\npassword"; \
pass "${selected_password}" \
| grep -P ':[\t ]' \
| gawk -F ':' '{ print $1 }';} \
| _rofi -kb-accept-entry '!Return' \
-dmenu \
-p "Choose Field to type > ")
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 == "< Return" ]]; then
mainMenu;
elif [[ $typefield == "${AUTOTYPE_field}" ]]; then
autopass
else
typeField
fi
@ -303,19 +297,13 @@ typeMenu () {
copyMenu () {
checkIfPass
copyfield=$({ echo -e "< Return\n---\npassword"; \
pass "${selected_password}" \
| grep -P ':[\t ]' \
| gawk -F ':' '{ print $1 }';} \
| _rofi -kb-accept-entry '!Return' \
-dmenu \
-p "Choose Field to copy > ")
if [[ $copyfield == "" ]]; then
copyfield=$(printf '%s\n' "${!stuff[@]}" | sort | _rofi -kb-accept-entry '!Return' -dmenu -p "Choose Field to type > ")
val=$?
if [[ $val -eq 1 ]]; then
exit;
elif [[ $copyfield == "password" ]]; then
fi
if [[ $copyfield == "password" ]]; then
copyPass;
elif [[ $copyfield == "< Return" ]]; then
mainMenu;
else
copyField
fi