Wl-copy doesn't integrate with system clipboard

Hello, I’m trying to debug why pasting from a wl-copy doesn’t work on my Wayland/GNOME
install.

In GDM, when I log in I choose “GNOME” session type, so it seems like I’m in a
Wayland session.

$ echo $XDG_SESSION_TYPE
wayland
$ echo $WAYLAND_DISPLAY
wayland-0
$ gnome-shell --version
GNOME Shell 46.10

Then in the terminal I can run these commands.

$ echo "hi" | wl-copy
$ wl-paste
hi

So far so good, except I can’t paste hi with the normal system shortcuts. If
I press ctrl+shift+v in the terminal, no paste happens. If I press ctrl+v
in Librewolf, GNOME text editor, or any graphical app—nothing happens, no
paste.

I’ve also tried wl-copy --primary and wl-copy --foreground, but those made
no difference.

If I highlight text and then right-click in the terminal or any GUI app, then
ctrl+v paste works fine.

Not sure but I think under Wayland a lot of this is running via dbus, so maybe some env vars are not matching between your terminal and GUI session.

For example to get to work, taking a screenshot in a script, I ran under Rasbian via cron, I had to get the Wayland env vars WAYLAND_DISPLAY, XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS from a process I knew had them.

(export $(tr '\0' '\n' < /proc/$(pgrep Xwayland)/environ | grep -E 'WAYLAND_DISPLAY|XDG_RUNTIME_DIR|DBUS_SESSION_BUS_ADDRESS' | awk '{print}' ORS=' ') ; grim  -t ppm -g "$RECT" "$TEMPLATE_IMAGE" >/dev/null 2>&1)

Aaaaah! I think I solved this!

I happened to install some package and wl-copy seems to work now! And even better I was able to bisect my generation history to find exactly the point where wl-copy starts working!

:heart: Guix!

Generation 26	Jul 08 2025 01:26:14	(current)
 + glib	2.82.1	bin	/gnu/store/0yj5hans4n8xdghqji0acmvf151lqlvi-glib-2.82.1-bin

After installing this package, echo "test7" | wl-copy now puts test7 into my system clipboard and I’m able to paste it in other GUI apps! :raising_hands:

I have no idea why this package fixes the issue, but when I switch to generation 25 it stops working, so this package seems to be the fix.


Btw, I was able to verify that WAYLAND_DISPLAY, XDG_RUNTIME_DIR, and DBUS_SESSION_BUS_ADDRESS had the same values in my terminal as /proc/pid/environ for my other apps.

1 Like