Linux cross paste (types clipboard content as keystrokes)
This is useful, when you need to paste some content from clipboard to some application like vmware's ESXI virtual machine for example or something similar.
This script will create crosspaste.desktop file in /usr/share/applications
which you can later invoke by running it as application via launcher or dock.
Basically idea was to clone similar functionality from this windows based solution
https://christitus.com/clickpaste/
To add it to dock, just right click and choose Add to Favorites
Copy-paste this command in terminal:
sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/acosonic/crosspaste/main/install.sh)" root
- Copy the text you need pasted on clipboard.
- Click paste icon (you have 2.5 seconds for next step)
- Switch to application where you need it pasted
- Wait for text to appear
- It uses xdtool to acheive keystroke typing taken from clipboard via xclip
- It waits 2.5 seconds to type keystrokes via sleep command, you can modify number of seconds by changing that
- Script downloads icon and places crosspaste.png to your home folder, you can change it by replacing icon with different one
- Script creates crosspaste.desktop in /usr/share/applications with following contents
Name=Cross Paste
Exec=/bin/bash -c "sh -c 'sleep 2.5; xdotool type \"$(xclip -o -selection clipboard)\"'"
Type=Application
Terminal=false
Icon=/home/youruser/crosspaste.png
To use this as keyboard shortcut, open ubuntu settings, and navigate to Keyboard Shortcuts then paste following to command window
sh -c 'sleep 2.5; xdotool type "$(xclip -o -selection clipboard)"'
If you have reverse problem, can't copy-paste from within for example VmWare ESX to your system, you can try ksnip tool with ksnip OCR plugin. Which can be installed via their continuous build dpkg archives
https://github.com/ksnip/ksnip/releases
https://github.com/ksnip/ksnip-plugin-ocr/releases/tag/continuous
Thanks to this askubuntu answer https://askubuntu.com/a/218306/513874
If you want to modify or manually edit shortcut, you can also do it here: ~/.local/share/application