Create a custom shortcut that types clipboard contents

Posted by briankb on Ask Ubuntu See other posts from Ask Ubuntu or by briankb
Published on 2012-11-05T12:12:15Z Indexed on 2012/11/05 23:19 UTC
Read the original article Hit count: 208

Filed under:
|
|

I want to paste my clipboard contents to a remote session such as VNC, IPMI, or Raritan. To accomplish this, I installed xdotool and clip. Then I wrote a simple command that types the clipboard contents:

xdotool type "$(xclip -o)"

This works if I stay in a terminal window, and type that command myself. It types back my clipboard contents when I run the command. Of course now I want to make this into a hotkey that works in any window.

However, if I create a custom shortcut using Keyboard settings, it doesn't work. If I assign a hotkey Alt+K to the shortcut, nothing happens when I press it.

Linux Sendkeys

If I use Ctrl+K, unexpected behavior occurs to whatever window has focus. e.g. my terminal window size shrinks (it's somewhat amusing, actually). Similar results occur if I save it as a script and call the script, or if I encapsulate the command with sh -c. How can I make practical use of the powerful xdotool type command?

© Ask Ubuntu or respective owner

Related posts about 12.10

Related posts about system-settings