-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with Wayland? (Linux) #25
Comments
Are you trying to run it in a Docker container (ubuntu:latest)? If so, using xvfb will be easier. That's what I use to run headless tests in a container.
Xvfb :0 -screen 0 1280x720x8 >/dev/null 2>&1 & # you can change resolution and display number
This doesn't need creating any window. Xvfb creates one in virtual memory, so this method works even without any display hardware. Alternatively, you can use Xwayland. There is an issue with getting screenshots on Wayland. But there's a workaround for that as well. I have described this issue and workaround at github.com/thevindu-w/clip_share_server/discussions/20#discussioncomment-7951942 |
Thanks for the hasty response. Let me stress my workflow, in case it helps you and really anyone to understand my hinder:
If you can describe how to run Xwayland under Wayland the way you state in the issue linked above it will be much appreciated. |
Isn't it a docker container where you run clip_share inside it? |
No, I'm running clip_share from the host. Does that make things more difficult? |
No. It should make it easier. Does the host have Wayland? and does it have XWayland? (usually it should have). Also does the host has real display hardware? |
If you are not using the container having X11 for anything other than clip_share, can you try to stop that container and re-run clip_share on the host without the X container? |
I've installed that Ubuntu container to run the .deb package of MS Edge. DISPLAY is set correctly it seems, :3 like in the XWayland call in the image. But I'll try to run clip_share from within the container actually, I just didn't want to add this extra step in. |
What is the DISPLAY variable on the host? Does that variable (on the host) change when you switch between containers? If that changes with the foreground container, things may become complicated. |
Just tested clip_share from within the container. DISPLAY remains the same (in this case :3). I installed libunistring-dev and the other pkgs you wrote with apt, but this error pops up nevertheless: |
You don't need the *-dev packages to run the compiled binaries. Anyway that will install libunistring. But If there's a mismatch in the version of it, this error may occur. Can you mention the original name of the clip_share executable you used? like |
Okay, I found the clip_share binary that corresponds to the container's GLIBC version. It is 2.35. But running that from within the container achieves the same result: when a X program launched by the container is in focus, managing the clipboard goes as expected; otherwise the mobile client outputs "could not connect" |
I guess this focus issue is arising with the containers. If the |
I see your reasoning but entering and leaving the container is not changing the DISPLAY variable in either the container or the host (at least by using the same shell for both) |
Then, is there a socket at /tmp/.X11-unix/X0 on the host? (if the DISPLAY variable is something other than |
Yes, there is, ./X0 and ./X1 as well |
Which one is used by the container (if it uses any of them)? Do these files change (or new files get added) when switching between containers? Also, try to run clip_share on the host (you need to stop clip_share in the container before doing this), and copy some text on the host (the text should be from an application running directly on the host, not an application running in a container). Does the mobile app get the text in this case? also check if it created a file |
I don't know how to find the socket directly, what I know is that both container and host have the DISPLAY variable set to 3. |
How is this possible when you only have cat /proc/<pid>/environ | tr '\0' '\n' | grep DISPLAY Replace the |
At that point in time X3 was a socket in that dir in case I wasn't clear. I ran that command from your previous response to get the corresponding DISPLAY of both konsole and clip_share. There were multiple konsole processes but having the same working dir, so I just picked the first one. Grep returned, respectively, for konsole and clip_share: WAYLAND_DISPLAY=wayland-0 |
So, if you copy some text in that konsole app, and try to get it from clip_share, does that work? |
I've just made sure the container was not running. I confirm I can send mobile clipboard to the desktop server, but not request desktop clipboard from the mobile app. |
Also tested with podman-desktop on the host, which is an X program. When it's focused ClipShare on mobile can exchange data with the server as usual. |
This seems to be an issue with the Wayland. I tried it on Wayland using XWayland to recreate the issue. But it worked as expected and getting copied text worked even when the application was not in the foreground (when a different app has focus).
If both xclip and clip_share couldn't get text, then try with different DISPLAY environment variables (display numbers can be taken from |
Nope, behavior is the same as clip_share, having tried what you suggested. I mean, the very same. I'll shortly provide a GIF capture of what I mean. |
I guess this is restricted by your Wayland compositor. Some compositors like Weston and GNOME Shell with Mutter (on Ubuntu) worked without such issue on getting copied text.
If xclip has the same issue as clip_share for all display numbers, then it would be hard to get the copied text. But that also means you can't copy or paste across different GUI apps (that depend on Xwayland) running on host. Is that the situation? Or do you use any clipboard manager app on the host? |
Works well in X11 windows, but it does nothing in Wayland managed ones. I've read the README and know libx11 is required, but isn't there any way to add compatibility with Wayland? Tested Wayland in Artix Linux kernel v 6.9.2-artix1-1, X in Distrobox's docker.io/library/ubuntu:latest image.
What I've tried and logically works is copying text on the server device, activating a X11 managed window launched by Distrobox and then requesting/sending it. But this is a bit too convoluted setup for me unless I actively practice it.
The text was updated successfully, but these errors were encountered: