From 1933e06da5601b0b560467666649152591275fbb Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Tue, 26 Jul 2016 23:05:11 +0200 Subject: [PATCH] add small delay --- rofi-pass | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/rofi-pass b/rofi-pass index f93587b..0129c51 100755 --- a/rofi-pass +++ b/rofi-pass @@ -60,7 +60,7 @@ autopass () { elif [[ $word == ":enter" ]]; then xdotool key Return; elif [[ $word == "pass" ]]; then - echo -n "${password}" | xdotool type --clearmodifiers --file -; + echo -n "${password}" | xdotool type --clearmodifiers --file - else echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file - fi @@ -69,16 +69,19 @@ autopass () { xdotool key Return fi fi + clearUp } openURL () { checkIfPass $BROWSER "$(pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit; + clearUp } typeUser () { checkIfPass echo -n "${stuff[${USERNAME_field}]}" | xdotool type --clearmodifiers --file - + clearUp } typePass () { @@ -97,26 +100,31 @@ typePass () { : fi fi + clearUp } typeField () { checkIfPass echo -n "${stuff[${typefield}]}" | xdotool type --clearmodifiers --file - + clearUp } copyUser () { checkIfPass echo -n "${stuff[${USERNAME_field}]}" | doClip + clearUp } copyField () { checkIfPass echo -n "${stuff[${copyfield}]}" | doClip + clearUp } copyURL () { checkIfPass echo -n "${stuff[${URL_field}]}" | doClip + clearUp } copyPass () { @@ -193,7 +201,6 @@ Type field of entry with Enter. For more help h -kb-custom-6 "${copy_pass}" \ -kb-custom-7 "${show}" \ -kb-custom-8 "${copy_url}" \ - -kb-custom-13 "${type_menu}" \ -kb-custom-14 "${action_menu}" \ -kb-custom-15 "${copy_menu}" \ -kb-custom-16 "${help}" \ @@ -204,7 +211,6 @@ Type field of entry with Enter. For more help h -p "rofi-pass > ")" rofi_exit=$? - # generate Array of fields password_temp=$(PASSWORD_STORE_DIR="${root}" pass "$selected_password") password="${password_temp%%$'\n'*}" @@ -215,34 +221,35 @@ Type field of entry with Enter. For more help h stuff["${_id}"]=${_val} done < <(echo "${password_temp}" | tail -n+2 | grep -P '(: |:\t)' ) stuff["pass"]=${password} + if test "${stuff['autotype']+autotype}" + then + : + else + stuff["autotype"]="user :tab pass" + fi fi - if test "${stuff['autotype']+autotype}" - then - : - else - stuff["autotype"]="user :tab pass" - fi; # actions based on keypresses 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 10 ]]; then sleep 0.2; 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 11 ]]; then sleep 0.2; typeUser; + elif [[ "${rofi_exit}" -eq 12 ]]; then sleep 0.2; typePass; elif [[ "${rofi_exit}" -eq 17 ]]; then copyURL; elif [[ "${rofi_exit}" -eq 16 ]]; then viewEntry; elif [[ "${rofi_exit}" -eq 15 ]]; then copyPass; - elif [[ "${rofi_exit}" -eq 22 ]]; then typeMenu; elif [[ "${rofi_exit}" -eq 23 ]]; then actionMenu; elif [[ "${rofi_exit}" -eq 25 ]]; then unset selected_password; helpMenu; elif [[ "${rofi_exit}" -eq 24 ]]; then copyMenu; elif [[ "${rofi_exit}" -eq 26 ]]; then $(${basecommand} --bmarks); elif [[ "${rofi_exit}" -eq 27 ]]; then insertPass; fi + clearUp } + clearUp () { password='' selected_password='' @@ -257,7 +264,6 @@ helpMenu () { helptext=$(echo -e "${autotype}: Autotype ${type_user}: Type Username ${type_pass}: Type Password -${type_menu}: Type Custom Field --- ${copy_name}: Copy Username ${copy_pass}: Copy Password @@ -284,12 +290,13 @@ typeMenu () { if [[ $typefield == "" ]]; then exit; elif [[ $typefield == "password" ]]; then - typePass; + typePass elif [[ $typefield == "${AUTOTYPE_field}" ]]; then autopass else typeField fi + clearUp } copyMenu () { @@ -304,6 +311,7 @@ copyMenu () { else copyField fi + clearUp } actionMenu () {