3

I want to quick paste some different strings using hotkeys. For example if I press Alt+L in any input form it works like if I pasted loremipsum. Or it may be some abbreviation, for example I enter li, press Tab and get loremipsum. Is it any software to do it?

I'm using Linux Mint with KDE desktop.

In Windows I could do it using AutoHotkey

1

You can use autokey-gtk

sudo apt-get install autokey-gtk

OR (my preferred solution) you can do that using xclip and xdotool:

sudo apt-get install xclip xdotool

Write a small bash script (e.g. paste_text.sh)

#!/bin/bash
clip_content=$(xclip -selection "clipboard" -o)
echo "$1" | xclip -selection "clipboard"
sleep 0.1
xdotool key ctrl+v
echo "$clip_content" | xclip -selection "clipboard"

(You might need to increase the sleep-time. Maybe someone finds a better solution than sleep and comment)

then make it executable

chmod +x paste_text.sh

Then you can add as many keyboard shortcuts to the script as you wish

/path/to/paste_text.sh "your text"

(Inspired by the answers from here)

  • Thank you for answer and for link to answer about autokey-gtk, it looks very useful. I did not succeed to find it. – Pavel Jan 4 '17 at 14:30
  • It looks like running this script will erase the current contents of your clipboard. – NonlinearFruit Jan 4 '17 at 15:13
  • 1
    that is true, it's using the standard clipboard. Maybe I should mention that. Ot better change the script so that it takes care <-- Done – pLumo Jan 4 '17 at 15:15

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.