No description
Find a file
2026-02-10 15:07:51 +01:00
nix update homepage 2026-02-10 15:07:51 +01:00
protocols new protocol, paste once any many many more 2025-12-05 01:48:27 +01:00
src ditch tree_magic dep for zmime yay 2026-02-08 14:42:35 +01:00
.envrc init 2025-11-25 13:18:51 +01:00
.gitignore use tree_magic_mini instead of libmagic 2026-01-04 15:49:47 +01:00
build.zig ditch tree_magic dep for zmime yay 2026-02-08 14:42:35 +01:00
build.zig.zon ditch tree_magic dep for zmime yay 2026-02-08 14:42:35 +01:00
deps.nix ditch tree_magic dep for zmime yay 2026-02-08 14:42:35 +01:00
flake.lock ditch tree_magic dep for zmime yay 2026-02-08 14:42:35 +01:00
flake.nix ditch tree_magic dep for zmime yay 2026-02-08 14:42:35 +01:00
LICENSE license 2025-12-09 22:35:14 +01:00
README.md readme 2026-01-04 15:49:51 +01:00

wl-clipboard-zig

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

Installing and Building

The recommended way to install wl-clipboard-zig is via Nix, using the flake provided in this repository. This project depends on my fork of tree_magic, and the flake pins the correct version automatically. If you try to build this outside of Nix, you will be signing up to solve dependency mismatches that Nix already solved for you.

You have two sane options:

Option 1: Add to your system or user configuration

If you are using NixOS or Home Manager, add this repository as an input and install the package from the flake outputs. This is the best option if you want reproducible builds and updates without surprises.

Option 2: Install directly with nix profile

For a quick, user-local install:

nix profile install git+https://forgejo.r0chd.pl/r0chd/wl-clipboard-zig

This will build and install wl-copy and wl-paste into your user profile.

Installing Nix on non-NixOS distributions

If you are not on NixOS, installing Nix is still trivial and strongly recommended.

nix-portable is especially useful on systems where you do not want to touch the host configuration or do not have root access.

Once Nix is available, the flake-based installation above works exactly the same on any distribution.

Building from source

You can build this project manually using Zig. You will need:

  • Zig 0.15.2
  • wayland-protocols
  • wayland-scanner
  • libwayland
  • My fork of tree_magic