- Both X11 and Wayland have
clipboard
andprimary
clipboards. Theclipboard
clipboard stores the text you copy. Theprimary
clipboard stores the text you select (not copy!) using the mouse. - When you paste using your keyboard, it pastes the text stored in the
clipboard
clipboard, but when you paste using middle click, it pastes from theprimary
clipboard. - The idea is to clear the
primary
clipboard, when you middle click so that nothing gets pasted, and we only clear theprimary
clipboard 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
xsel
is installed. If you are using Waylan