aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-11-10 11:04:49 +0100
committerRasmus Steinke <rasi@xssn.at>2015-11-10 11:04:49 +0100
commit24992e36b153365be7441cad1a63861d3d90d5d3 (patch)
tree5dc26a2674140c1aed0bd8eade4f9a847ac59674
parent46f88a25c2066fa46247b208d38b2190b645b08a (diff)
downloadrofi-pass-24992e36b153365be7441cad1a63861d3d90d5d3.tar.gz
add possibility to generate a new password for entry
-rw-r--r--config.example2
-rwxr-xr-xrofi-pass22
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"
diff --git a/rofi-pass b/rofi-pass
index d0677f3..8cde766 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -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 -