Mouse Middle Click Not Pasting Selected Text in Terminal

clipboardmouse

I am experiencing a weird phenomenon recently. Usually, when we select any text anywhere (browser, files, terminal) it gets copied to the clipboard and can be pasted upon clicking the middle button (wheel in my case). This used to work for me earlier, but recently, this feature has stopped working for the terminal.

For instance, when I select any text in the terminal and then middle click the mouse, what gets pasted is the last selection that was done in the browser (firefox) but not the recent/expected terminal selection. The feature works as expected for browser-only copy pastes, i.e., if I select any text from browser and middle click in the browser itself it pastes the correct selection.

I am using Gnome on Ubuntu with Xorg.
Any fix?

Best Answer

Start a new xterm:

xterm -ls -xrm 'XTerm*selectToClipboard: true' &

To permanently enable it, add this line to ~/.Xdefaults or ~/.Xresources file.

xterm*selectToClipboard: true

If you have no such file, create it and add the line above. Start with .Xresources, if it doesn't work delete it and create .Xdefaults.

I don't have any clue on the same thing on gnome-terminal.

Related Question