Managing Clipboards


The X10 window system specified buffers named cut buffers for saving snippets of arbitrary text. Cut buffers were since replaced by so-called seletions with the introduction of the X11 window system. In X11, there are three types of selections: PRIMARY, SECONDARY, and CLIPBOARD. Any type of selection is often simply referred to as the clipboard. For matters of consistency, X11 applications must use only a single selection type (this was different under X10 where an application was able to control multiple cut buffers). Applications typically only use either PRIMARY or CLIPBOARD (check the ArchWiki and Inter-Client Communication Conventions Manual (ICCCM) for further information).

Some applications define their own keybindings (and let the user change them) for accessing selections. Common keybindings to copy text include Ctrl-C, Ctrl-Alt-C, Ctrl-Shift-C, and Ctrl-Insert. To cut text, i.e., to copy text to a selection while deleting it in the application, the bindings Ctrl-X, Ctrl-Alt-X, Ctrl-Shift-X, and Shift-Delete are commonly used. Frequent keybindings for pasting text include Ctrl-V, Ctrl-Alt-V, Ctrl-Shift-V, and Shift-Insert. Text can often be copied to PRIMARY by selecting it using the mouse. A mouse middle-click commonly pastes text from PRIMARY into the application.

Clipboard managers allow for streamlining copy, cut, and paste operations involving different type of selections. Most clipboard managers keep a history of copied or cut text. Some managers are also able to consolidate selections by copying entered text from one selection to all other selections, thereby keeping the text buffers of the selections consistent. Additionally, some managers allow you to reorder and edit the text buffers. A list of clipboard managers for Linux is available from the ArchWiki.

One example of a feature-rich clipboard manager is CopyQ. Besides the aforementioned features, the program allows for cycling through the selection buffers and searching their content. Moreover, CopyQ supports Vim keybindings, can be controlled from the command-line, and is available under Mac OS X, Windows, and Linux. You can disable or enable mouse copy and paste actions in the program's preferences. In case the CopyQ window is in the background, the command copyq toggle brings the selection history to the foreground and in focus, thus allowing you to access any selection buffer. Setting a keybinding for copyq toggle in your window manager, enables you to have the CopyQ history readily available.

Update 2017-01-26: Using a clipboard manager comes with the benefit that you can check what you are gonna paste before you paste it. This benefit is particularly valuable when you copy commands from a website that you want to paste into a terminal, as what you see is not always what you get.