clipboard.rst 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. clipboard
  2. ==================================================
  3. .. only:: man
  4. Overview
  5. --------------
  6. *Copy/paste to the system clipboard from shell scripts*
  7. .. highlight:: sh
  8. The ``clipboard`` kitten can be used to read or write to the system clipboard
  9. from the shell. It even works over SSH. Using it is as simple as::
  10. echo hooray | kitten clipboard
  11. All text received on :file:`STDIN` is copied to the clipboard.
  12. To get text from the clipboard::
  13. kitten clipboard --get-clipboard
  14. The text will be written to :file:`STDOUT`. Note that by default kitty asks for
  15. permission when a program attempts to read the clipboard. This can be
  16. controlled via :opt:`clipboard_control`.
  17. .. versionadded:: 0.27.0
  18. Support for copying arbitrary data types
  19. The clipboard kitten can be used to send/receive
  20. more than just plain text from the system clipboard. You can transfer arbitrary
  21. data types. Best illustrated with some examples::
  22. # Copy an image to the clipboard:
  23. kitten clipboard picture.png
  24. # Copy an image and some text to the clipboard:
  25. kitten clipboard picture.jpg text.txt
  26. # Copy text from STDIN and an image to the clipboard:
  27. echo hello | kitten clipboard picture.png /dev/stdin
  28. # Copy any raster image available on the clipboard to a PNG file:
  29. kitten clipboard -g picture.png
  30. # Copy an image to a file and text to STDOUT:
  31. kitten clipboard -g picture.png /dev/stdout
  32. # List the formats available on the system clipboard
  33. kitten clipboard -g -m . /dev/stdout
  34. Normally, the kitten guesses MIME types based on the file names. To control the
  35. MIME types precisely, use the :option:`--mime <kitty +kitten clipboard --mime>` option.
  36. This kitten uses a new protocol developed by kitty to function, for details,
  37. see :doc:`/clipboard`.
  38. .. program:: kitty +kitten clipboard
  39. .. include:: /generated/cli-kitten-clipboard.rst