I want to simulate keyboard input so that I can "paste" my clipboard contents to applications that don't allow it (e.g. remote KVM). Right now, I'm trying to use xdotool
and xclip
:
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 it works in any application.
If I use this hotkey, 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?
sh -c 'xdotool type "$(xclip -o)"'
instead ?sh -c
(gedit opening new tabs). Oddly, it stopped doing anything after I tried different hotkeys.