Problem
I had a text on the clipboard and I wanted to automate the Shift+Insert (paste) keypress. That is, I wanted to paste the content of the clipboard using a script.
Solution
I have a Bash script and when I run this script, this script at the end should paste the content of the clipboard.
First I came up with a Python solution using the excellent PyAutoGUI library:
python -c "import pyautogui; pyautogui.hotkey('shift', 'insert')"
It did the job but it required the pyautogui library to be installed. Then I found a solution that doesn’t need this dependency. This one relies on the Linux command xdotool:
xdotool key Shift+Insert
That’s it. Done :)


You must be logged in to post a comment.