diff options
author | Rasmus Steinke <rasi@xssn.at> | 2015-11-10 11:04:49 +0100 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2015-11-10 11:04:49 +0100 |
commit | 24992e36b153365be7441cad1a63861d3d90d5d3 (patch) | |
tree | 5dc26a2674140c1aed0bd8eade4f9a847ac59674 | |
parent | 46f88a25c2066fa46247b208d38b2190b645b08a (diff) | |
download | rofi-pass-24992e36b153365be7441cad1a63861d3d90d5d3.tar.gz |
add possibility to generate a new password for entry
-rw-r--r-- | config.example | 2 | ||||
-rwxr-xr-x | rofi-pass | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/config.example b/config.example index 77e612b..51bcd56 100644 --- a/config.example +++ b/config.example @@ -27,6 +27,7 @@ BROWSER='chromium' help_color='#0C73C2' auto_enter='false' notify='false' +passlength='20' # seconds to wait before re-opening showEntry-menu # after autotyping an entry. Set to "off" to disable @@ -49,3 +50,4 @@ move="Alt+2" delete="Alt+3" copy_entry="Alt+c" show="Control+Return" +generate="Alt+g" @@ -39,7 +39,7 @@ checkIfPass () { # main Menu mainMenu () { - help_text=$(echo -e "${autotype}: Autotype - ${copy_name}: Copy User - ${edit}: Edit - ${show}: Show Entry\n${type_user}: Type User - ${copy_pass}: Copy Pass - ${move}: Move\n${type_pass}: Type Pass - ${copy_url}: Copy URL - ${delete}: Delete" | column -s '-' -t) + help_text=$(echo -e "${autotype}: Autotype - ${copy_name}: Copy User - ${edit}: Edit - ${show}: Show Entry\n${type_user}: Type User - ${copy_pass}: Copy Pass - ${move}: Move - ${generate}: Generate Pass\n${type_pass}: Type Pass - ${copy_url}: Copy URL - ${delete}: Delete" | column -s '-' -t) line1=$(echo "${help_text}" | head -1) line2=$(echo "${help_text}" | tail -2 | head -1) line3=$(echo "${help_text}" | tail -1) @@ -59,6 +59,7 @@ ${line3}</span>" -kb-custom-9 "${edit}" \ -kb-custom-10 "${move}" \ -kb-custom-11 "${delete}" \ + -kb-custom-12 "${generate}" \ -dmenu \ -select "$entry" \ -p "rofi-pass > ")" @@ -122,6 +123,25 @@ ${line3}</span>" elif [[ "${rofi_exit}" -eq 20 ]]; then manageEntry delete; + elif [[ "${rofi_exit}" -eq 21 ]]; then + checkIfPass + symbols=$(echo -e "0 Cancel\n---\n1 Yes\n2 No" | rofi -dmenu -p "Use Symbols? > ") + if [[ $symbols == "0 Cancel" ]]; then + mainMenu + elif [[ $symbols == "1 Yes" ]]; then + symbols="" + elif [[ $symbols == "2 No" ]]; then + symbols="-n" + fi + HELP="<span color='$help_color'>Enter Number or hit Enter to use default length</span>" + length=$(echo -e "" | rofi -dmenu -mesg "${HELP}" -p "Password length? (Default: ${passlength}) > ") + if [[ $length == "" ]]; then + pass generate ${symbols} -i "$selected_password" "${passlength}" > /dev/null + else + pass generate ${symbols} -i "$selected_password" "${length}" > /dev/null + fi + exit + elif [[ $rofi_exit -eq 12 ]]; then checkIfPass echo -n "${password}" | xdotool type --clearmodifiers --file - |