Problem copying non-text content after using xclip

Ubuntu 24.10.

After enabling xclip-mode from Emacs (the nox version), usually when I copy a non-text e.g. an image from Gwenview or a file from Dolphin, only the “text form” is copied and pasted, in this case the full path of the image/file. I am also using Klipper, and from Klipper I can see that the text form is added to the clipboard.

At this time, a process exists “/usr/bin/xclip -selection CLIPBOARD”.

If I repeat the copying process, e.g. press Ctrl-C again in Gwenview, then I can see in Klipper the actual image is now added to the clipboard. And by this time, the xclip process disappears.

But the problem would repeat itself if I copy another image or file, which is annoying because I will need to copy twice.

If I kill all xclip process that might exist, then disable xclip-mode in Emacs, the problem disappears.

Any clue on how I might resolve this? I used the same setup on my previous laptop (Ubuntu 24.04) and the problem doesn’t exist there.

Hi - I’m not an expert on the matter, but it sounds like xclip, Emacs, or some combination of the two is interfering with what gets added to the clipboard somehow? It might be worth checking if there are reports for this issue with the xclip or Emacs projects, as well.

And for what it’s worth, one issue with kind-of-similar symptoms was reported in the KDE Bugtracking System - 417590 – With MaxClipItems=1 NoEmptyClipboard=false, the second time you copy text after emptying the clipboard, you need to invoke "copy" twice - and that was fixed in Plasma 6.3, so it might also be worth checking that once you upgrade. Ubuntu 24.10 reached end-of-life in less than two months, so it’d be good to prepare for that soon :slight_smile:

[quote=“johnandmegh, post:2, topic:34846”]
Hi - I’m not an expert on the matter, but it sounds like xclip, Emacs, or some combination of the two is interfering with what gets added to the clipboard somehow? [/quote]

Yup, I figured as much. I haven’t tried downgrading xclip or related software to what’s included in Ubuntu 24.04, but will perhaps try that. Will also try upgrading to the newer Ubuntu release soon. Thanks.