Difference between revisions of "Clipboard"

From ArchWiki
Jump to navigation Jump to search
m (Correct typo in related page link.)
 
(132 intermediate revisions by 46 users not shown)
Line 1: Line 1:
[[Category:X Server]]
+
[[Category:X server]]
 +
[[Category:Lists of software]]
 +
[[es:Clipboard]]
 
[[fr:Copier coller]]
 
[[fr:Copier coller]]
{{expansion}}
+
[[ja:クリップボード]]
==History==
+
{{Related articles start}}
In X10, "cut buffers" were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.
+
{{Related|Copying text from a terminal}}
 +
{{Related|Firefox#Middle-click behavior}}
 +
{{Related|GTK#Disable mouse paste}}
 +
{{Related|Vim#Clipboard}}
 +
{{Related articles end}}
  
==Background==
+
{{Expansion|Describe clipboards for [[Wayland]] and XWayland. Some references: [https://wiki.gnome.org/Initiatives/Wayland/PrimarySelection], [https://github.com/swaywm/sway/issues/1012], [https://bugreports.qt.io/browse/QTBUG-66008].}}
The ICCCM (Inter-Client Communication Conventions Manual) standard defines three "selections": PRIMARY, SECONDARY, and CLIPBOARD. Despite the naming, all three are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections. However, in some cases, this can produce strange outcomes, such as a bidirectional shared clipboard with Windows (which uses a single-clipboard system) in a virtual machine.
 
  
Of the three selections, users should only be concerned with PRIMARY and CLIPBOARD. SECONDARY is only used inconsistently and was intended as an alternate to PRIMARY. Different applications may treat PRIMARY and CLIPBOARD differently; however, there is a degree of consensus that CLIPBOARD should be used for Windows-style clipboard operations, while PRIMARY should exist as a "quick" option, where text can be selected using the mouse or keyboard, then pasted using the middle mouse button (or some emulation of it). This can cause confusion and, in some cases, inconsistent or undesirable results from rogue applications.
+
According to [[Wikipedia:Clipboard (computing)|Wikipedia]]:
 +
:The clipboard is a facility used for short-term data storage and/or data transfer between documents or applications, via [[Wikipedia:copy and paste|copy and paste]] operations.
  
==Clipboard Managers==
+
== History ==
There is a variety of clipboard managers available, and several desktop environments come with their own clipboard manager or have a clipboard manager intended for them ([https://launchpad.net/glipper/ Glipper] for [[GNOME]] and [http://goodies.xfce.org/projects/panel-plugins/xfce4-clipman-plugin Clipman] for [[Xfce]]); however, there are several DE-agnostic clipboard managers such as [http://parcellite.sourceforge.net/ Parcellite] (GTK+) and [http://www.nongnu.org/autocutsel/ autocutsel] (command-line), both of which are available in [community] and can be run as daemons.
 
  
==Resources==
+
In X10, ''cut buffers'' were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as [[xterm]]) may have legacy support for them, it is both not likely and not recommended that they be used.
  
*[[List of Applications/Utilities#Clipboard_managers|List of clipboard manager packages]]
+
== Selections ==
  
*[http://standards.freedesktop.org/clipboards-spec/clipboards-latest.txt Cut-and-paste in X]
+
[[Freedesktop.org]] describes the two main ''selections'' as follows:[https://specifications.freedesktop.org/clipboards-spec/clipboards-latest.txt]
  
*[http://www.jwz.org/doc/x-cut-and-paste.html X Selections, Cut Buffers, and Kill Rings.]
+
;PRIMARY: Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
 +
;CLIPBOARD: Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle [https://stackoverflow.com/questions/3571179/how-does-x11-clipboard-handle-multiple-data-formats multiple data formats].
 +
 
 +
The majority of programs for [[Xorg]], including [[Qt]] and [[GTK]] applications, follow this behavior. While [https://tronche.com/gui/x/icccm/ ICCCM] also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.
 +
 
 +
See the [[Keyboard shortcuts]] page which lists the default shortcuts in many programs.
 +
 
 +
It is also important to realize that according to the selection protocols, nothing is copied [https://unix.stackexchange.com/questions/213840/how-to-toggle-or-turn-off-text-selection-being-sent-to-the-clipboard/213843#213843 until it is pasted]. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a [[clipboard manager]].
 +
 
 +
{{Note|[[#Managers|Clipboard managers]] can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.}}
 +
 
 +
== Tools ==
 +
 
 +
This section lists command-line tools to manipulate the clipboards.
 +
 
 +
* {{App|sselp|Simple X selection printer. Prints the X selection to stdout.|http://tools.suckless.org/x/sselp|{{AUR|sselp}}}}
 +
* {{App|xclip|A lightweight, command-line based interface to the clipboard.|https://github.com/astrand/xclip|{{Pkg|xclip}}}}
 +
* {{App|xsel|Command-line program for getting and setting the contents of the X selection.|http://www.vergenet.net/~conrad/software/xsel/|{{Pkg|xsel}}}}
 +
 
 +
== Managers ==
 +
 
 +
This section lists daemons that track your clipboard, to provide a clipboard history and/or synchronization.
 +
 
 +
* {{App|Anamnesis|Clipboard manager that stores all the clipboard history and offers an interface to do a full-text search. It has both a command line and GUI mode available.|http://anamnesis.sourceforge.net/|{{AUR|anamnesis}}}}
 +
* {{App|Autocutsel|Command line and daemon interfaces to synchronize PRIMARY, {{Ic|CLIPBOARD}} and cut buffer selections.|http://www.nongnu.org/autocutsel/|{{Pkg|autocutsel}}}}
 +
* {{App|Clipboard Indicator|Clipboard manager extension for GNOME Shell. Adds a clipboard indicator to the top panel, and caches clipboard history.|https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator|{{AUR|gnome-shell-extension-clipboard-indicator-git}}}}
 +
* {{App|ClipIt|Fork of Parcellite.It has both a command line and GUI mode available.|https://github.com/CristianHenzel/ClipIt|{{AUR|clipit}}}}
 +
* {{App|Clipman|Clipboard manager plugin for the Xfce4 panel. It keeps the clipboard contents around while it is usually lost when you close an application. It is able to handle text and images, and has a feature to execute actions on specific text selections by matching them against regular expressions.|https://goodies.xfce.org/projects/panel-plugins/xfce4-clipman-plugin|{{Pkg|xfce4-clipman-plugin}}}}
 +
* {{App|ClipManager|Cross-platform clipboard manager written in Python and Qt.|https://github.com/scottwernervt/clipmanager|{{AUR|clipmanager}}}}
 +
* {{App|Clipmenu|Dmenu based clipboard manager|https://github.com/cdown/clipmenu/|{{Pkg|clipmenu}}}}
 +
* {{App|Clipster|A lightweight, command-line-driven clipboard manager, written in Python.|https://github.com/mrichar1/clipster|{{AUR|clipster}}, {{AUR|clipster-git}}}}
 +
* {{App|CopyQ|Clever Qt clipboard manager with searchable and editable history, custom actions on items and command line support.|https://github.com/hluk/CopyQ|{{Pkg|copyq}}}}
 +
* {{App|[[Wikipedia:Glipper|Glipper]]|Clipboard manager for the GNOME desktop with many features and plugin support.|https://launchpad.net/glipper|{{AUR|glipper}}}}
 +
* {{App|GPaste|Clipboard management system that aims at being a new generation Parcellite, with a modular structure split in a couple of libraries and a daemon for adaptability. Offers a GNOME Shell extension and a CLI interface.|https://github.com/Keruspe/GPaste|{{Pkg|gpaste}}}}
 +
* {{App|[[Greenclip]]|Simple clipboard manager to be integrated with rofi|https://github.com/erebe/greenclip|{{AUR|rofi-greenclip}}}}
 +
* {{App|[[Wikipedia:Klipper|Klipper]]|Full featured clipboard manager for the KDE desktop.|https://userbase.kde.org/Klipper|{{Pkg|plasma-workspace}}}}
 +
* {{App|Parcellite|Lightweight yet feature-rich clipboard manager. It has both a command line and GUI mode available.|http://parcellite.sourceforge.net/|{{Pkg|parcellite}}}}
 +
* {{App|Pasteall|Clipboard monitor simple and functional (with notifications in Portuguese).|https://github.com/ShyPixie/Pasteall|{{AUR|pasteall}}}}
 +
* {{App|Qlipper|Lightweight and cross-platform clipboard history applet based on Qt.|https://github.com/pvanek/qlipper/|{{AUR|qlipper}}}}
 +
* {{App|xclipboard|Official X clipboard command-line client.|https://www.x.org/releases/X11R7.5/doc/man/man1/xclipboard.1.html|{{Pkg|xorg-xclipboard}}}}
 +
* {{App|xcmenu|Clipboard synchronizer developed for window manager users.|https://github.com/dindon-sournois/xcmenu|{{AUR|xcmenu-git}}}}
 +
 
 +
== See also ==
 +
 
 +
* [https://specifications.freedesktop.org/clipboards-spec/clipboards-latest.txt Cut-and-paste in X]
 +
* [https://www.jwz.org/doc/x-cut-and-paste.html X Selections, Cut Buffers, and Kill Rings.]

Latest revision as of 02:18, 29 September 2019

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Describe clipboards for Wayland and XWayland. Some references: [1], [2], [3]. (Discuss in Talk:Clipboard#)

According to Wikipedia:

The clipboard is a facility used for short-term data storage and/or data transfer between documents or applications, via copy and paste operations.

History

In X10, cut buffers were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.

Selections

Freedesktop.org describes the two main selections as follows:[4]

PRIMARY
Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
CLIPBOARD
Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle multiple data formats.

The majority of programs for Xorg, including Qt and GTK applications, follow this behavior. While ICCCM also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.

See the Keyboard shortcuts page which lists the default shortcuts in many programs.

It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.

Note: Clipboard managers can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.

Tools

This section lists command-line tools to manipulate the clipboards.

  • sselp — Simple X selection printer. Prints the X selection to stdout.
http://tools.suckless.org/x/sselp || sselpAUR
  • xclip — A lightweight, command-line based interface to the clipboard.
https://github.com/astrand/xclip || xclip
  • xsel — Command-line program for getting and setting the contents of the X selection.
http://www.vergenet.net/~conrad/software/xsel/ || xsel

Managers

This section lists daemons that track your clipboard, to provide a clipboard history and/or synchronization.

  • Anamnesis — Clipboard manager that stores all the clipboard history and offers an interface to do a full-text search. It has both a command line and GUI mode available.
http://anamnesis.sourceforge.net/ || anamnesisAUR
  • Autocutsel — Command line and daemon interfaces to synchronize PRIMARY, CLIPBOARD and cut buffer selections.
http://www.nongnu.org/autocutsel/ || autocutsel
  • Clipboard Indicator — Clipboard manager extension for GNOME Shell. Adds a clipboard indicator to the top panel, and caches clipboard history.
https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator || gnome-shell-extension-clipboard-indicator-gitAUR
  • ClipIt — Fork of Parcellite.It has both a command line and GUI mode available.
https://github.com/CristianHenzel/ClipIt || clipitAUR
  • Clipman — Clipboard manager plugin for the Xfce4 panel. It keeps the clipboard contents around while it is usually lost when you close an application. It is able to handle text and images, and has a feature to execute actions on specific text selections by matching them against regular expressions.
https://goodies.xfce.org/projects/panel-plugins/xfce4-clipman-plugin || xfce4-clipman-plugin
  • ClipManager — Cross-platform clipboard manager written in Python and Qt.
https://github.com/scottwernervt/clipmanager || clipmanagerAUR
  • Clipmenu — Dmenu based clipboard manager
https://github.com/cdown/clipmenu/ || clipmenu
  • Clipster — A lightweight, command-line-driven clipboard manager, written in Python.
https://github.com/mrichar1/clipster || clipsterAUR, clipster-gitAUR
  • CopyQ — Clever Qt clipboard manager with searchable and editable history, custom actions on items and command line support.
https://github.com/hluk/CopyQ || copyq
  • Glipper — Clipboard manager for the GNOME desktop with many features and plugin support.
https://launchpad.net/glipper || glipperAUR
  • GPaste — Clipboard management system that aims at being a new generation Parcellite, with a modular structure split in a couple of libraries and a daemon for adaptability. Offers a GNOME Shell extension and a CLI interface.
https://github.com/Keruspe/GPaste || gpaste
  • Greenclip — Simple clipboard manager to be integrated with rofi
https://github.com/erebe/greenclip || rofi-greenclipAUR
  • Klipper — Full featured clipboard manager for the KDE desktop.
https://userbase.kde.org/Klipper || plasma-workspace
  • Parcellite — Lightweight yet feature-rich clipboard manager. It has both a command line and GUI mode available.
http://parcellite.sourceforge.net/ || parcellite
  • Pasteall — Clipboard monitor simple and functional (with notifications in Portuguese).
https://github.com/ShyPixie/Pasteall || pasteallAUR
  • Qlipper — Lightweight and cross-platform clipboard history applet based on Qt.
https://github.com/pvanek/qlipper/ || qlipperAUR
  • xclipboard — Official X clipboard command-line client.
https://www.x.org/releases/X11R7.5/doc/man/man1/xclipboard.1.html || xorg-xclipboard
  • xcmenu — Clipboard synchronizer developed for window manager users.
https://github.com/dindon-sournois/xcmenu || xcmenu-gitAUR

See also