LinuxCommandLibrary

wl-paste

Tool to access data stored in the clipboard for Wayland.

TLDR

Paste the contents of the clipboard

$ wl-paste
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-copy [--primary] [--trim-newline] [--paste-once] [--foreground] [--clear] [--type mime/type] [--seat seat-name] [text...]

wl-paste [--primary] [--no-newline] [--list-types] [--type mime/type] [--seat seat-name] [--watch command...]

DESCRIPTION

wl-copy copies the given text to the Wayland clipboard. If no text is given, wl-copy copies data from its standard input.

wl-paste pastes data from the Wayland clipboard to its standard output.

Although wl-copy and wl-paste are particularly optimized for plain text and other textual content formats, they fully support content of arbitrary MIME types. wl-copy automatically infers the type of the copied content by running xdg-mime(1) on it. wl-paste tries its best to pick a type to paste based on the list of offered MIME types and the extension of the file it's pasting into. If you're not satisfied with the type they pick or don't want to rely on this implicit type inference, you can explicitly specify the type to use with the --type option.

OPTIONS

-p, --primary

Use the "primary" clipboard instead of the regular clipboard.

-o, --paste-once

Only serve one paste request and then exit. Unless a clipboard manager specifically designed to prevent this is in use, this has the effect of clearing the clipboard after the first paste, which is useful for copying sensitive data such as passwords. Note that this may break pasting into some clients, in particular pasting into XWayland windows is known to break when this option is used.

-f, --foreground

By default, wl-copy forks and serves data requests in the background; this option overrides that behavior, causing wl-copy to run in the foreground.

-c, --clear

Instead of copying anything, clear the clipboard so that nothing is copied.

-n, --trim-newline

Do not copy the trailing newline character if it is present in the input file.

-n, --no-newline

Do not append a newline character after the pasted clipboard content. This option is automatically enabled for non-text content types and when using the --watch mode.

-t mime/type, --type mime/type

Override the automatically selected MIME type. For wl-copy this option controls which type wl-copy will offer the content as. For wl-paste it controls which of the offered types wl-paste will request the content in. In addition to specific MIME types such as image/png, wl-paste also accepts generic type names such as text and image which make it automatically pick some offered MIME type that matches the given generic name.

-s seat-name, --seat seat-name

Specify which seat wl-copy and wl-paste should work with. Wayland natively supports multi-seat configurations where each seat gets its own mouse pointer, keyboard focus, and among other things its own separate clipboard. The name of the default seat is likely default or seat0, and additional seat names normally come from the udev(7) property ENV{WL_SEAT}. You can view the list of the currently available seats as advertised by the compositor using the weston-info(1) tool. If you don't specify the seat name explicitly, wl-copy and wl-paste will pick a seat arbitrarily. If you are using a single-seat system, there is little reason to use this option.

-l, --list-types

Instead of pasting the selection, output the list of MIME types it is offered in.

-w command..., --watch command...

Instead of pasting once and exiting, continuously watch the clipboard for changes, and run the specified command each time a new selection appears. The spawned process can read the clipboard contents from its standard input. This mode requires a compositor that supports the wlroots data-control protocol.

-v, --version

Display the version of wl-clipboard and some short info about its license.

-h, --help

Display a short help message listing the available options.

ENVIRONMENT

WAYLAND_DISPLAY

Specifies what Wayland server wl-copy and wl-paste should connect to. This is the same environment variable that you pass to other Wayland clients, such as graphical applications, that connect to this Wayland server. It is normally set up automatically by the graphical session and the Wayland compositor. See wl_display_connect(3) for more details.

WAYLAND_DEBUG

When set to 1, causes the wayland-client(7) library to log every interaction wl-copy and wl-paste make with the Wayland compositor to stderr.

EXAMPLES

$ wl-copy Hello world!

$ ls ~/Downloads | wl-copy

$ wl-copy < ~/Pictures/photo.png

$ wl-copy "!!"

$ wl-paste -n > clipboard.txt

$ wl-paste --list-types | wl-copy

REPORTING BUGS

Report wl-clipboard bugs to <https://github.com/bugaevc/wl-clipboard/issues>

COPYRIGHT

Copyright © 2019 Sergey Bugaev. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO

xclip(1), xsel(1), wl-clipboard-x11(1)

AUTHOR

Written by Sergey Bugaev.

Copied to clipboard