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.


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.

  • Out of interest, why is the sleep 0.5 necessary? I noticed that it does not work without this. – Exeleration-G Sep 21 '16 at 9:35
  • 1
    @Exeleration-G If I remember well (it is a while ago) it is to make sure the shortcut keypress does not interfere with the simulated keypress by xdotool. – Jacob Vlijm Sep 21 '16 at 10:17
  • 2
    xdotool type --clearmodifiers 'youremail@server.com' – DmitrySandalov Jan 23 '18 at 13:26
  • @Jacob Vlijm I tried your method, but got disable for the shortcut no matter which key combinations I tried. – fixit7 Jul 13 '18 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.