clipboard#

Copy/paste to the system clipboard from shell scripts

The clipboard kitten can be used to read or write to the system clipboard from the shell. It even works over SSH. Using it is as simple as:

echo hooray | kitty +kitten clipboard

All text received on stdin is copied to the clipboard.

To get text from the clipboard you have to enable reading of the clipboard in clipboard_control in kitty.conf. Once you do that, you can use:

kitty +kitten clipboard --get-clipboard

Source code for clipboard#

The source code for this kitten is available on GitHub.

Command Line Interface#

kitty +kitten clipboard [options]

Read or write to the system clipboard.

To set the clipboard text, pipe in the new text on STDIN. Use the --get-clipboard option to output the current clipboard contents to stdout. Note that reading the clipboard will cause a permission popup, see clipboard_control for details.

Options#

--get-clipboard#

Output the current contents of the clipboard to STDOUT. Note that by default kitty will prompt you asking to allow access to the clipboard. Can be controlled by clipboard_control. Default: False

--use-primary#

Use the primary selection rather than the clipboard on systems that support it, such as X11. Default: False

--wait-for-completion#

Wait till the copy to clipboard is complete before exiting. Useful if running the kitten in a dedicated, ephemeral window. Default: False