Keyboard Maestro: Swap Clipboard With Selection31 Aug 2022
Like many computer users, I work with text a lot, and I am thankful every day for the first person who came up with the idea of copy and paste. I cannot even begin to think about how my computing life would be without this wonderful addition. But, even the clipboard can be improved, and there are clipboard manager apps that let you supercharge your workflow, giving you access to your clipboard history. With these powerful tools at my fingertips, I still found a niggle, so I fixed it with a little Keyboard Maestro macro.
Every now and then I find myself in a position where I want to swap some selected text with what is on the clipboard.
Now, using a clipboard manager I could copy the current selection to the clipboard, then give the appropriate incantation to skip back one in the clipboard history and paste that in. Depending on the clipboard manager, this may involve switching the clipboard history around manually, selecting it from some list, or doing some other little dance of digits on the keyboard.
Because this felt a little clunky and totally repeatable, I figured I could put together a little Keyboard Maestro macro to do this for me - so I did.
The macro uses a named clipboard (called
Temporary) to hold a copy of the system clipboard. It then replaces the system clipboard with the current selection and pastes in the content from the named clipboard. In doing do, that seemed to reuse the system clipboard, so as a final step I delete the last item in the clipboard history to bring the previously selected text into the system clipboard as the current clipboard content.
I’ve set the macro to be triggered when I select
CTRL + SHIFT + S, but you can of course change it to whatever trigger you prefer.
Keyboard Maestro is perfect for these little quality of life automations and every one makes me that little bit more efficient.