implement custom keybindings

This commit is contained in:
Rasmus Steinke 2015-06-17 19:50:21 +02:00
parent 0d78505bfd
commit a7a25d34be
2 changed files with 19 additions and 15 deletions

View File

@ -15,3 +15,10 @@ BROWSER='chromium'
## Misc settings ## Misc settings
help_color="#0C73C2" help_color="#0C73C2"
autotype="Alt+1"
type_user="Alt+2"
type_pass="Alt+3"
open_url="Alt+4"
copy_name="Alt+c"
copy_pass="Alt+Shift+c"

View File

@ -57,10 +57,6 @@ xdotool_type() {
done done
} }
notify () {
7aa3C2
}
mainMenu () { mainMenu () {
if [[ -z "$root" ]]; then if [[ -z "$root" ]]; then
get_root get_root
@ -85,9 +81,9 @@ mainMenu () {
mainMenu manage mainMenu manage
fi fi
else else
HELP="<span color='$help_color'>Alt+1: Autotype | Alt+2: Type User | Alt+3: Type Password HELP="<span color='$help_color'>${autotype}: Autotype | ${type_user}: Type User | ${type_pass}: Type Password
Alt+4: Open URL | Alt+c: Copy Username | Alt+Shift+c: Copy Password</span>" ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Password</span>"
selected_password="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | rofi -mesg "${HELP}" -dmenu -select "$entry" -kb-custom-8 "Alt+c" -kb-custom-9 "Alt+Shift+c" -p "rofi-pass > ")" selected_password="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | rofi -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}" -dmenu -select "$entry" -kb-custom-8 "Alt+c" -kb-custom-9 "Alt+Shift+c" -p "rofi-pass > ")"
rofi_exit=$? rofi_exit=$?
if [[ "${rofi_exit}" -eq 0 ]]; then true; if [[ "${rofi_exit}" -eq 0 ]]; then true;
elif [[ "${rofi_exit}" -eq 10 ]]; then true; elif [[ "${rofi_exit}" -eq 10 ]]; then true;
@ -137,8 +133,8 @@ Alt+4: Open URL | Alt+c: Copy Username | Alt+Shift+c: Copy Password</span>"
done done
xdotool_type "$password" xdotool_type "$password"
fi fi
exit exit
else else
if [[ -z "${stuff['CustomOrder']}" ]]; then if [[ -z "${stuff['CustomOrder']}" ]]; then
xdotool_type "${stuff[${USERNAME_field}]}" xdotool_type "${stuff[${USERNAME_field}]}"
xdotool key Tab xdotool key Tab
@ -165,11 +161,11 @@ Alt+4: Open URL | Alt+c: Copy Username | Alt+Shift+c: Copy Password</span>"
showEntry () { showEntry () {
menu=$(echo -e "0 Return to Manage Menu\n---\n$(pass "$selected_password")" | rofi -dmenu -p "> ") menu=$(echo -e "0 Return to Manage Menu\n---\n$(pass "$selected_password")" | rofi -dmenu -p "> ")
if [[ $menu == "0 Return to Manage Menu" ]]; then mainMenu manage if [[ $menu == "0 Return to Manage Menu" ]]; then mainMenu manage
elif [[ $menu == "" ]]; then exit elif [[ $menu == "" ]]; then exit
else else
showEntry showEntry
fi fi
} }
manageEntry () { manageEntry () {
@ -242,7 +238,7 @@ insertPass2 () {
capitals="True" capitals="True"
password_gen password_gen
else else
insertPass2 insertPass2
fi fi
} }
@ -270,12 +266,13 @@ password_gen () {
symbols=$(echo -e "True\nFalse" | rofi -dmenu -p "Symbols? > ") symbols=$(echo -e "True\nFalse" | rofi -dmenu -p "Symbols? > ")
password_gen password_gen
else else
insertPass2 "$menu" insertPass2 "$menu"
fi fi
} }
mainMenu mainMenu
help_msg () { help_msg () {
echo "rofi-pass - a rofi driven frontend to pass" echo "rofi-pass - a rofi driven frontend to pass"
echo "--------------------------------------" echo "--------------------------------------"