需运行在 Wayland 会话下,X11 环境不可用;从源码构建需参考 BUILDING.md,README 未给出具体依赖
Wayland 下的命令行剪贴板工具,用 wl-copy 和 wl-paste 在管道、文件和剪贴板之间搬运数据
Wayland 下的命令行剪贴板工具,提供 wl-copy 和 wl-paste 两个命令,让脚本和终端也能读写系统剪贴板。
核心能力
- 用 wl-copy 把管道、文件或图片写入剪贴板
- 用 wl-paste 把剪贴板内容输出到文件或管道
- 支持 --watch 监听剪贴板变化并触发命令
- 可与 sort、nc 等 Unix 工具组合成流水线
容易踩的坑
- v2.3.0wl-clipboard 2.3最新正式版2026-03-22 · 2026-03-22 19:00 UTC
This is an incremental release. It contains:
- Various bug & issue fixes.
- Support for the
ext-data-control-v1protocol, kindly contributed by @zzag. - Some support for the
wl-copy --sensitiveflag, andCLIPBOARD_STATE=sensitivehint inwl-paste --watchmode. There are both implemented throughx-kde-passwordManagerHint, and should be compatible with (at least) Klipper and KeePassXC.
- v2.2.1wl-clipboard 2.2.12023-08-27 · 2023-08-27 19:01 UTC
查看更新说明
This is a tiny bug fix release that contains fixes for the two regressions that turned up in 2.2.
- v2.2.0wl-clipboard 2.22023-07-23 · 2023-07-23 17:51 UTC
查看更新说明
2.2 is a minor release; but it still got some cool new things in it!
-
The errors wl-clipboard emits are now less terse and more friendly to a casual user.
-
Many bug and issue fixes.
-
A revised and improved man page.
-
wl-clipboard now attempts even more hacks to grab focus on certain compositors.
-
wl-paste --watchmode gained basic support for the "clipboard state" mini-protocol, where is sets theCLIPBOARD_STATEenvironment variable for the spawned command to describe the clipboard state. This finally completes the missing bit ofwl-paste --watchfunctionality that we always wanted: exposing the empty clipboard state to the spawned command too.The clipboard state protocol is intentionally designed in a way that it could be extended with more useful information in the future (should the Wayland clipboard protocols provide this information to wl-clipboard). It is also intentionally not tied to either wl-clipboard or Wayland; other clipboard tools could implement it, and are encouraged to do so! The SerenityOS
pasteutility (which is a little clone ofwl-pastefor SerenityOS) already implements the same protocol (in fact, it implemented it long before wl-clipboard did). So if you work on a clipboard tool such aspbpaste,xclip, orxsel, please consider adopting the clipboard state protocol. -
Temporary files that
wl-copycreates are now unlinked much sooner. We're looking forward to potentially switching over to usingfile(1)for content type detection, which will hopefully allow us to completely get rid of the temporary files. -
wl-clipboard will now detect when it is launched with closed stdio file descriptors, complain about it, and abort. This is not a supported way of running wl-clipboard (nor other Unix software, other than on a setuid boundary), and this does lead to seemingly impossible bugs. So far, users have reported hitting this case when trying to run wl-clipboard (or other software) from a shortcut under KDE Plasma.
-
wl-clipboard can now be built with all Wayland-related dependencies coming from Meson wrap subprojects. This is primarily intended to help people building wl-clipboard from source who don't or can't install their distribution-provided versions of those dependencies. Using system-provided dependencies is of course still the preferred method to build wl-clipboard.
In particular, wl-clipboard will now try harder to prevent you from accidentally building it without support for additional Wayland protocols, which became de facto required once many Wayland compositors have dropped support for
wl_shell. Accidentally building wl-clipboard without additional protocols and getting a pair of completely non-functional binaries was a source of frustration for many users. It is still possible to build wl-clipboard without additional protocols (using neither the system version, nor the wrap subproject one) by passing-D protocols=disabledwhen configuring wl-clipboard, if you know what you're doing.
Compatibility notes:
- Unfortunately, we had to bump the Meson build system requirement to version 0.47 or later (up from 0.44).
- The Wayland clipboard implementation in Weston and KWin (KDE Plasma) compositors is currently broken (to various degrees, more so in KWin than in Weston). This may affect wl-clipboard most, but it's not a bug in wl-clipboard, and certainly not new in wl-clipboard 2.2.
Finally, I'd like to extend a big thank you to @YaLTeR, who took care of wl-clipboard while I could not, and even got the previous release out.
-
- v2.1.0wl-clipboard 2.12022-03-19 · 2022-03-19 12:21 UTC
查看更新说明
2.1 is a minor release with a few bugfixes and fish completions.
- Fixed
wl-copyhangs when followed by a pipe (e.g.echo "text to copy" | wl-copy | cat) by properly closing stdin/stdout file descriptors. - Fixed a crash that occasionally happened in
do_set_selection(). - Added fish completions. Similarly to zsh completions, a
fishcompletiondirmeson flag has been added to control them at build time. - Fixed a build warning related to pointer arithmetic.
- Fixed
- v2.0.0wl-clipboard 2.02019-10-03 · 2019-10-03 12:26 UTC
查看更新说明
2.0 is a big, long-awaited release! 🎉
The guts of wl-clipboard have been completely rewritten to fix multiple issues and enable new functionality, all while keeping the same user- and scripting-friendly interface, and the same do-what-I-mean type matching logic.
The new features since 1.0, the previous release, include: • Multiseat support; use the new
--seatoption to pass a seat name; • A new--trim-newlineoption forwl-copyto go with the existing--no-newlineoption ofwl-paste; • Support for wlr-data-control and wp-primary-selection protocol extensions; • Support for BSD, Mac OS X, and GNU Hurd systems in addition to Linux; • Bash and Zsh shell completion; • Allow continuously watching the clipboard for changes, also known aswl-paste --watch.There were also a lot of bug fixes and other internal improvements.
wl-clipboard 2.0 is designed to be completely Sway-native (while keeping the same level of support for other compositors). When running on Sway (or other wlroots-based compositors, or any compositor that implements the wlroots data-control protocol), wl-clipboard will use the proper interface to access the clipboard and will not attempt any focus stealing hacks it has to resort to otherwise.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
wl-clipboard: Wayland clipboard utilities
This project implements two command-line Wayland clipboard utilities, wl-copy
and wl-paste, that let you easily copy data between the clipboard and Unix
pipes, sockets, files and so on.
# Copy a simple text message:
$ wl-copy Hello world!
# Copy the list of files in ~/Downloads:
$ ls ~/Downloads | wl-copy
# Copy an image:
$ wl-copy < ~/Pictures/photo.png
# Copy the previous command:
$ wl-copy "!!"
# Paste to a file:
$ wl-paste > clipboard.txt
# Sort clipboard contents:
$ wl-paste | sort | wl-copy
# Upload clipboard contents to a pastebin on each change:
$ wl-paste --watch nc paste.example.org 5555
Please see the wl-clipboard(1) man page for more details.
Installing
wl-clipboard is likely available in your favorite Linux or BSD distro. For building from source, see BUILDING.md.
License
wl-clipboard is free software, available under the GNU General Public License version 3 or later.
Related projects
- wl-clipboard-x11: A wrapper to use wl-clipboard as a drop-in replacement to X11 clipboard tools.
- wl-clipboard-rs: A Rust crate
(library) for working with the Wayland clipboard which includes a
reimplementation of
wl-copyandwl-paste.