You are not logged in.

#1 2025-06-20 13:18:48

ahmadconradi
Member
Registered: 2025-06-20
Posts: 4

VMWare only works with xsel, not xclip

Hi,

I wonder why when on the Arch host I do:
echo "your clipboard content from xclip here" | xclip -selection clipboard

VMWare does not update the clipboard of the Win geust, but when I do:
echo "your clipboard content from xsel here" | xsel --clipboard

it works as expected. Dont these programs do exactly the same thing?

Offline

#2 2025-06-20 15:55:26

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,994

Re: VMWare only works with xsel, not xclip

Is there also a clipboard manager on the host?
Is the xclip process still alive after vmware didn't update the clipboard?

Online

#3 2025-06-20 22:03:31

ahmadconradi
Member
Registered: 2025-06-20
Posts: 4

Re: VMWare only works with xsel, not xclip

> Is there also a clipboard manager on the host?

Yes, `greenclip daemon` is running in the background.

> Is the xclip process still alive after vmware didn't update the clipboard?

Yes it is still alive. It also updates the clipboard just fine (for the rest of the X11 Desktop), but VMWare does not receive the new content.

But with xsel, VMWare receives it as expected.

Offline

#4 2025-06-20 22:52:18

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,994

Re: VMWare only works with xsel, not xclip

What happens if you remove the clipboard manager?

https://tronche.com/gui/x/icccm/sec-2.html#s-2.1

Clients attempting to acquire a selection must set the time value of the SetSelectionOwner request to the timestamp of the event triggering the acquisition attempt, not to CurrentTime

https://github.com/astrand/xclip/blob/2 … lip.c#L467
https://github.com/kfish/xsel/blob/7a13 … el.c#L1020
https://github.com/kfish/xsel/blob/7a13 … sel.c#L547

I suspect this leads to a race condition w/ the clipboard manager

Online

#5 2025-06-21 11:38:56

ahmadconradi
Member
Registered: 2025-06-20
Posts: 4

Re: VMWare only works with xsel, not xclip

The behavior stays the same even with the greenclip daemon killed.

> Clients attempting to acquire a selection must set the time value of the SetSelectionOwner request to the timestamp of the event triggering the acquisition attempt, not to CurrentTime

Does that mean there is a bug in xclip? Because in the code you referenced, I see CurrentTime is being used. On line 475 it even says:

FIXME: Should not use CurrentTime, according to ICCCM section 2.1

https://github.com/astrand/xclip/blob/2 … lip.c#L475

> I suspect this leads to a race condition w/ the clipboard manager

Maybe VMWare itself works similar to a clipboard manager for monitoring the clipboard?

Offline

#6 2025-06-21 13:30:53

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,994

Re: VMWare only works with xsel, not xclip

Maybe VMWare itself works similar to a clipboard manager for monitoring the clipboard?

Possibly - it's the only idea I can come up with what would cause a difference here.
The clipboard on X11 is neither really a thing ("state" - hence the manager, otherwise the clients just arrange who has data to offer) nor overly complicated and since xclip can (I guess) otherwise reliably read data and claim selection ownership, a race condition around the bogus timestamp is the nearest explanation. Notably since xsel differs in this.
No idea how to verify this, though.

Online

#7 2025-06-21 20:20:49

ahmadconradi
Member
Registered: 2025-06-20
Posts: 4

Re: VMWare only works with xsel, not xclip

For the record, I reported this here: https://github.com/astrand/xclip/issues/163

Offline

Board footer

Powered by FluxBB