added clipboard setting

This commit is contained in:
Rasmus Steinke 2015-08-13 18:41:07 +02:00
parent 2f38b32d89
commit 4f1d2900d5
2 changed files with 20 additions and 5 deletions

View File

@ -24,6 +24,10 @@ BROWSER='chromium'
help_color='#0C73C2' help_color='#0C73C2'
auto_enter='false' auto_enter='false'
# Clipboard settings
# Possible options: primary, clipboard, both
clip=primary
# Custom Keybindings # Custom Keybindings
autotype="Alt+1" autotype="Alt+1"
type_user="Alt+2" type_user="Alt+2"

View File

@ -54,6 +54,18 @@ xdotool_type() {
done done
} }
doClip () {
if [[ $clip == "primary" ]]; then
xclip
elif [[ $clip == "clipboard" ]]; then
xclip -selection clipboard
elif [[ $clip == "both" ]]; then
xclip
xclip -o | xclip -selection clipboard
fi
}
# main Menu # main Menu
mainMenu () { mainMenu () {
HELP="<span color='$help_color'>${autotype}: Autotype | ${type_user}: Type User | ${type_pass}: Type Password HELP="<span color='$help_color'>${autotype}: Autotype | ${type_user}: Type User | ${type_pass}: Type Password
@ -90,13 +102,12 @@ ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Passwor
echo -n "${password}" | xdotool type --clearmodifiers --file - echo -n "${password}" | xdotool type --clearmodifiers --file -
exit exit
elif [[ $rofi_exit -eq 14 ]]; then elif [[ $rofi_exit -eq 14 ]]; then
echo -n "${stuff[${USERNAME_field}]}" | xclip echo -n "${stuff[${USERNAME_field}]}" | doClip
exit exit
elif [[ $rofi_exit -eq 16 ]]; then elif [[ $rofi_exit -eq 16 ]]; then
showEntry "${selected_password}" showEntry "${selected_password}"
elif [[ $rofi_exit -eq 15 ]]; then elif [[ $rofi_exit -eq 15 ]]; then
echo -n "$password" | xclip echo -n "$password" | doClip
xclip -o | xclip -selection clipboard
notify-send "rofi-pass" "Copied Password\nClearing in 45 seconds" 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") & $(sleep 45; echo -n "" | xclip; echo "" | xclip -selection clipboard | notify-send "rofi-pass" "Clipboard cleared") &
exit exit
@ -186,9 +197,9 @@ showEntry () {
echo "not doing anything" echo "not doing anything"
else else
if [[ -z $(echo -n "${stuff[${word}]}") ]]; then if [[ -z $(echo -n "${stuff[${word}]}") ]]; then
echo -n "$word" | xclip echo -n "$word" | doClip
else else
echo -n "${stuff[${word}]}" | xclip echo -n "${stuff[${word}]}" | doClip
fi fi
fi fi
elif [[ ${rofi_exit} -eq 10 ]]; then elif [[ ${rofi_exit} -eq 10 ]]; then