From ecc2af0c71006518c2b0e64c618ef34d1d6009cf Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Thu, 28 Jul 2016 19:34:39 +0200 Subject: [PATCH] simplify show menu --- rofi-pass | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/rofi-pass b/rofi-pass index 9b0265f..1e8d7a3 100755 --- a/rofi-pass +++ b/rofi-pass @@ -337,23 +337,25 @@ actionMenu () { showEntry () { HELP="${copy_entry}: Copy Entry" - bla=$(echo -e "${pass_content}" | _rofi -kb-accept-entry '!Return' -dmenu -mesg "${HELP}" -p "> ") + bla=$(echo -e "< Return\n${pass_content}" | _rofi -kb-accept-entry '!Return' -dmenu -mesg "Enter: Copy entry to clipboard" -p "> ") rofi_exit=$? word=$(echo "$bla" | gawk -F': ' '{print $1}') - if [[ ${rofi_exit} -eq 0 ]]; then - mainMenu - elif [[ ${rofi_exit} -eq 1 ]]; then + if [[ ${rofi_exit} -eq 1 ]]; then exit - elif [[ ${rofi_exit} -eq 11 ]]; then - if [[ -z $(echo -n "${stuff[${word}]}") ]]; then - echo -n "$word" | doClip + elif [[ ${rofi_exit} -eq 0 ]]; then + if [[ ${bla} == "< Return" ]]; then + mainMenu else - echo -n "${stuff[${word}]}" | doClip + if [[ -z $(echo -n "${stuff[${word}]}") ]]; then + echo -n "$word" | doClip + else + echo -n "${stuff[${word}]}" | doClip + fi + notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds" + $(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") & + exit fi - notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds" - $(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") & - exit fi exit unset stuff