michaelforney / swc

a library for making a simple Wayland compositor
MIT License
614 stars 52 forks source link

X11 clipboard synchronization #66

Open fbushstone opened 3 years ago

fbushstone commented 3 years ago

It seems like swc (I'm using velox) does not have support for copying and pasting between applications. I can copy and paste within ungoogled-chromium and within st-wl, but I can't copy from st-wl and paste into ungoogled-chromium, for example. Also, wl-clipboard seems to have no effect at all.

Steps to reproduce: Open st-wl. wl-copy test wl-paste Apparently wl-paste will not detect the selection.

Copying text in st-wl and pasting it in st-wl works fine (it even works between different st-wl windows), same thing with ungoogled-chromium. However, I can't copy and paste through wl-clipboard and copy+pasting does not work between windows of different programs.

ianbeyst commented 3 years ago

Are you using my repository for st-wl? If so, I think the problem might be there instead of at swc's side. I think some parts of the copy and paste parts in my version of st for wayland are stubs and are yet to be implemented.

fbushstone commented 3 years ago

@ianbeyst Yes, I am. I haven't really gotten a chance to test clipboard support on anything other than st-wl and Chromium (since so many things are just electron at this point, or if they aren't, they're ncurses apps).

ianbeyst commented 3 years ago

Can you check if you also have problems with the clipboard with another terminal emulator that works in wayland, like alacritty or something?

fbushstone commented 3 years ago

I checked with Kitty. Works in Kitty but not xterm, Alacritty, or urxvt.

fbushstone commented 3 years ago

It seems this is at least somewhat related to swc though. Try the steps outlined above on velox, then on sway.

ianbeyst commented 3 years ago

No you're probably right, if the problem shows up elsewhere too. It's been a while since I worked on st-wl (it was mostly an exercise to teach myself some C) but I vaguely remember something about clipboard.

michaelforney commented 3 years ago

What protocol does wl-copy/wl-paste use? If it is not wl_data_device in the core protocol, than swc does not yet implement it.

X11 applications use the X11 clipboard, and swc does not synchronize it with the wayland clipboard. This would be a nice feature to have, but X11 clipboard details are pretty complex. I don't use Xwayland much (in fact, it was removed for a while and re-added at the request of some users), so if you want this feature, you'll probably have to implement it yourself.