LinuxCommandLibrary

wl-paste

Paste Wayland clipboard data to standard output

TLDR

Paste the contents of the clipboard

$ wl-paste
copy

Paste the contents of the primary clipboard (highlighted text)
$ wl-paste --primary
copy

Write the contents of the clipboard to a file
$ wl-paste > [path/to/file]
copy

Pipe the contents of the clipboard to a command
$ wl-paste | [command]
copy

SYNOPSIS

wl-paste [options]

PARAMETERS

-h, --help
    Display help message and exit.

-p, --primary
    Use the primary selection (middle-click paste) instead of the clipboard.

-n, --no-newline
    Do not add a newline character at the end of the output.

-t , --type
    Specify the MIME type to retrieve. If not specified, wl-paste will attempt to retrieve the data in the most suitable format.

-l, --list-types
    List available MIME types for the clipboard content.

-w, --watch
    Wait for a new clipboard content to become available, print it and exit.

-o, --on-change
    Wait for clipboard content to become available, then execute the specified command with clipboard content as stdin.

-f, --file
    Write the clipboard contents to the specified file instead of stdout.

DESCRIPTION

The wl-paste command is a utility used in Wayland compositors (window managers) to retrieve the contents of the system clipboard and print them to standard output. This is particularly useful for scripting or automating tasks that involve copying and pasting data. Unlike X11-based systems, Wayland requires specific tools to interact with the clipboard due to its different architecture and security model.

wl-paste directly interacts with the Wayland compositor to access clipboard data, providing a secure and efficient way to manage copied information. It supports various data types, allowing it to handle text, images, and other content formats. The command is a crucial part of many Wayland workflows, enabling users to easily transfer data between applications.

CAVEATS

wl-paste relies on the Wayland compositor's implementation of the clipboard protocol. Some compositors may not fully support all features or data types. It also requires a Wayland session to be running.

MIME TYPES

The -t option allows you to specify the MIME type of the data you want to retrieve from the clipboard. Common MIME types include 'text/plain', 'text/html', 'image/png', and 'image/jpeg'. Use the -l option to list the available MIME types for the current clipboard content to ensure you are requesting a valid type.

SEE ALSO

wl-copy(1)

Copied to clipboard