Another xdotool suggestion, working in Debian Jessie 8.7 (Jan 2017):
xdotool click --delay 0 --clearmodifiers 2
- xdotool handles multi-byte strings (p.e. UTF-8), unlike xvkbd.
xdotool click simulates an actual click, so you don't have to click yourself to paste at mouse position, as you would have if you used
xdotool type, or xvkbd.
The only problem is that
--clearmodifiers will "press" back any modifier (Ctrl/Alt/Shift/Meta) you use after simulating the click. Even with
--delay 0 (instead of 12ms), the command takes a little to execute. If you release the keys before it ends, your modifiers will be "pressed" again, and stuck there until you press and release the actual key once more.
So with this you have to be a bit "slow" (50ms?) to release your modifiers, if you're using any.
You can test this by setting up your keyboard shortcut, using it into a text editor, and then pressing a key (like
a, or an arrow). The letter should appear in lowercase. If something else happens, you are too fast and a modifier is stuck (p.e. Shift if it's in caps, Ctrl if you selected all text, Alt if you opened a menu). Press and release your modifiers again to reset them.
If you're too fast, you can use ilkerk's suggestion:
sh -c 'sleep 0.3 && xdotool type --clearmodifiers --delay 0 "`xsel`"'
Then you have to release them in less than 300ms, and wait half a second for the text to appear.
xdotool type means you insert the text as if you where typing, at the text cursor position, and not the mouse pointer. You can change it to
click if you prefer the usual middle-click behaviour.
(made this post so newcomers don't have to piece the puzzle pieces spread in the comments again)