You are not logged in.

#1 Yesterday 19:18:39

Koatao
Member
Registered: 2018-08-30
Posts: 111

QEMU SPICE how to achieve bidirectional clipboard with Sway?

Hi,

I have a ArchLinux host and QEMU guest running Sway (Wayland Compositor) with wl-clipboard.

Guest is ran through Libvirt. And I use Virtual Machine Manager as GUI.
Here is my libvirt config for the guest domain: https://pastebin.com/uv7QaAmj.

I must have 3d acceleration on the guest.
My host has an integrated GPU (AMD Ryzen 7 8845HS w/ Radeon 780M Graphics)
If I understand correctly, in this situation, I must use virtio GPU with 3d acceleration on and a SPICE display with OpenGL on.


I'm struggling to achieve bidirectional clipboard sharing between my host and my guest.
I understand that spice-vdagent is not designed for Wayland, and thus it is not 100% functionnal with some compositor like Sway  (I'm guessing anything using wlroots).

As of now, I have clipboard sharing from host to guest like so:
- Copy anything on the host
- Pass the content through xsel to wl-clipboard on the guest:

xsel | wl-copy

It doesn't work the other way around from guest to host (even if I do `wl-paste | xsel` first on the guest).


Did anyone manage do make it work in a similar setup?
Does anyone with better understanding of clipboard and Wayland have some ideas that might work?

I'm thinking about implementing a cheap clipboard sharing solution thought a UNIX socket shared between the host and the guest and some notification system.
But I'm lacking the knowledge and understanding to evaluate how stupid of an idea it is?

PS: I've tried paprika-vdagent but it makes the guest unusable through the SPICE agent.

Last edited by Koatao (Yesterday 19:23:00)

Offline

#2 Today 07:55:58

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,580

Re: QEMU SPICE how to achieve bidirectional clipboard with Sway?

Far as I know this still doesn't work so for me the following solution works fine
For sharing information I'm using a shared directory, the next line is in my QEMU command on the host

-virtfs local,path=/home/user/share,mount_tag=host0,security_model=mapped,id=host0

And with this line on the guest the shared directory is mounted on the guest

# mkdir /mnt/share && mount -t 9p -o trans=virtio,version=9p2000.L host0 /mnt/share

Since I don't virt-manager you may need to figure that out on your own
You need to at least change 'user' in the first line

edit: for more info on that second line: https://wiki.qemu.org/Documentation/9p

Last edited by qinohe (Today 08:49:07)

Offline

#3 Today 11:42:44

tekstryder
Member
Registered: 2013-02-14
Posts: 522

Re: QEMU SPICE how to achieve bidirectional clipboard with Sway?

EDIT:

Disregard my irrelevant post (removed).

A quick look into the topic and the functionality is not natively supported in this context (spice-vdagent).

Seems simple enough to establish an SSH tunnel to pass clipboard contents via:

# On Guest: Send clipboard to Host
wl-paste | ssh user@host_ip "wl-copy"

# On Host: Send clipboard to Guest
wl-paste | ssh user@guest_ip "wl-copy"

Set up some keybinds.

Last edited by tekstryder (Today 12:00:15)

Offline

Board footer

Powered by FluxBB