- Both X11 and Wayland have
clipboardandprimaryclipboards. Theclipboardclipboard stores the text you copy. Theprimaryclipboard stores the text you select (not copy!) using the mouse. - When you paste using your keyboard, it pastes the text stored in the
clipboardclipboard, but when you paste using middle click, it pastes from theprimaryclipboard. - The idea is to clear the
primaryclipboard, when you middle click so that nothing gets pasted, and we only clear theprimaryclipboard so the text you copied previously will remain as-is.
- Install a key binding daemon that is capable of listening to mouse button clicks (middle click in our case) and executing shell commands. I personally recommend evsieve.
- If you are using X11, make sure
xselis installed. If you are using Waylan