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?

  • 1
    Which terminal do you use? – Krackout Jun 25 '20 at 8:13
  • @Krackout xterm – SKR Jun 25 '20 at 8:50
  • Try this: xterm -ls -xrm 'XTerm*selectToClipboard: true' & It'll open a new xterm, see if middle click copy-paste works there. If it works I'll type it as an answer, plus a way to make it permanent. – Krackout Jun 25 '20 at 9:09
  • Yes, this worked. You can post it as answer. Could you please also include the syntax for the gnome-terminal? There also I face the same issue. – SKR Jun 25 '20 at 9:47

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.

  • Any clue as to why this helps? As I understand it, this makes XTerm use the clipboard instead of the primary. – Quasímodo Jun 25 '20 at 11:34
  • Exactly @Quasimodo. Apparently primary has stopped working on SKR's xterm, can't tell why. As an alternative I prompted him to switch to clipboard. Technically not the same thing, but little to no difference to UX. – Krackout Jun 25 '20 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.