Create a custom shortcut that types clipboard contents
- by briankb
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.
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?