save last used site. call it with --last-used. solves rofi blocking input

This commit is contained in:
Rasmus Steinke 2015-08-05 08:11:45 +02:00
parent e3e6ceb7c5
commit e93d74fab6

View File

@ -58,17 +58,13 @@ xdotool_type() {
mainMenu () {
HELP="<span color='$help_color'>${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</span>"
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 > ")"
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 > ")"
rofi_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
if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "URL: " | awk -F 'URL: ' '{ print $2 }')"; exit;
elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit};
elif [[ "${rofi_exit}" -eq 10 || "${rofi-exit}" -eq 0 ]]; then true
fi
@ -313,6 +309,9 @@ case $1 in
--help)
help_msg
;;
--last-used)
entry="$(cat $HOME/.config/rofi-pass/last_used)" mainMenu
;;
*)
mainMenu
;;