6

Using st with dwm, depending on the way I select text (e.g. mouse vs keyboard), and where the text is (e.g. document body vs address bar), copying text from firefox and pasting it into st does not always work.

Are there two different clipboards?

Is there a way to unify them?

  • Do you copy with ctrl-c or are you just relying on text-highlighting to copy? – drs Jun 9 '14 at 16:21
  • This question and the comments there may be relevant: superuser.com/questions/140944/… – njsg Oct 11 '14 at 9:11
7

In a sense, yes there are two different clipboards (though X11 calls them "selections", and only one of the selections is called “the clipboard”).

In all likelihood, you are thinking of the Primary Selection (an understandable mistake considering that it functions much more like one on Linux distros than it does under Windows or Mac—though, for the record, the same keyboard shortcuts can typically be used to interact with the Primary Selection under Windows and Mac as they are under Linux).

The clipboard is typically controlled via the Ctrl+{c,v} key bindings for Copy and Paste (respectively). The Primary Selection, on the other hand, has several means of interaction. With the mouse, selecting anything automatically places it in the Primary Selection. Then, one can typically middle-click to Paste from it. One can also use the keyboard: {Ctrl,Shift}+Insert may be used for Copy and Paste (again, respectively) from/to the Primary Selection.

Oddly, it seems X's clipboard is not supported by every application. And, though it may seem unfortunate, there is no way to unify the Primary Selection and the Clipboard. However, there are two solutions for you.

  1. Use the Primary Selection
    It is almost universally available and (at least, it my humble opinion) is a fair bit more flexible.

  2. Use an alternative clipboard manager
    There are plenty of third-party clipboard managers out there which offer far more powerful functionality than the built-in.

Just for example, you could use xcmenu or xclip. There are, however, more alternatives than I can count.


A while after writing this answer, I stumbled upon a clipboard manager called clipit. Among other features that can be quite handy, clipit offers the ability to synchronize the Primary Selection and the X Clipboard. This is functionally equivalent to unifying the two selections and has been really nice to have; I imagine it is exactly what you are looking for.

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.