I want to automate keyboard input so that I can "paste" my clipboard contents to a remote KVM such as IPMI, or Raritan. To accomplish this, I installed xdotool and xclip. I then wrote a simple command that types the clipboard contents:
xdotool type "$(xclip -o)"
This command works if I stay in a terminal window, and type that command myself. It types back my clipboard contents when I run the command. My goal is to bind this command to a hotkey so that works in any window that has focus.
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?
My steps to test this hotkey are as follows:
- Copy the text
- Click on gedit
- Press the hotkey