Search code examples
pythonpython-3.xclipboard

How can I create a program that runs commands as soon as I copy something to clipboard


I want to write a program that will run a few lines on any piece of data or string upon copying to clipboard, is there a way to do this? I cant find much information about it.


Solution

  • I found https://pyperclip.readthedocs.io/en/latest/index.html

    It has the pyperclip.waitForPaste() function, which should do exactly what you want. I had issues trying it with Linux Fedora, but it should be no problem on most Systems.