Keyboard Shortcut – Using a Keyboard Shortcut to Paste Text

shortcut-keys

There are lots of websites which only allow signing in with email address and password and I am tired of typing a long email address. I don't want my browser to remember my email. Can I assign a keyboard shortcut to print this email address so that every time I press the key I get my email address on current text field?

I am using Ubuntu 14.04 and I have very little knowledge about Ubuntu. I'm not talking about snippets. Just a defined text to paste when the key is pressed.

Best Answer

To paste a single string into a textfield

  1. install both xdotool and xclip:

    sudo apt-get install xdotool xclip
    
  2. Add the following command to a shortcut key:

    /bin/bash -c "sleep 0.5 && printf 'youremail@server.com' | xclip -selection clipboard && xdotool key Control_L+v"
    

    Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command above to a key combination of your choice.

Now when enter the cursor in a textfield and choose your shortcut, it will type your email address.

Related Question