astrand / xclip

Command line interface to the X11 clipboard
GNU General Public License v2.0
1.03k stars 73 forks source link

Selection ownership gets lost immediately on weston-xwayland setup #139

Open tusharsnx opened 1 year ago

tusharsnx commented 1 year ago

When xclip is used with Wayland compositor Weston, xclip loses selection ownership immediately and returns without waiting for SelectionRequest. Weston usually takes ownership before any X client on the server, due to which when xclip creates a window on the server and sets selection ownership together (b/c window creation request remains buffered until XGetSelectionOwner() ), the xclip receives SelectionClear immediately after it.

Debug log:

$ xclip -i -debug -sel clip <<< "hello"
xclip: debug: Debugging enabled.
Connected to X server.
Using selection: XA_CLIPBOARD
Using target: UTF8_STRING.
Waiting for selection requests, Control-C to quit

xclip: debug: Received SelectionClear event
Lost selection ownership. (window id 0x200001 did a copy).
xclip: debug: checking for requestors whose window has closed
Exiting.

Note: window id 0x200001 belongs to xwayland.

I have also tested the behaviour against master.

other reference issues: microsoft/terminal#11945