Skip to content
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

client: support WAYLAND_SOCKET env var #25

Merged
merged 1 commit into from
Feb 1, 2025
Merged

Conversation

MaxVerevkin
Copy link
Owner

Closes #24

@MaxVerevkin
Copy link
Owner Author

@WhyNotHugo do you have an easy way to test this?

@WhyNotHugo
Copy link
Contributor

import socket
import os
import subprocess

xdgrun = os.environ["XDG_RUNTIME_DIR"]
display = os.environ["WAYLAND_DISPLAY"]
socket_path = f"{xdgrun}/{display}"

sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(socket_path)
fd = sock.fileno()

new_env = os.environ.copy()
new_env.pop("WAYLAND_DISPLAY")
new_env["WAYLAND_SOCKET"] = str(fd) # Comment this line to confirm that WAYLAND_DISPLAY is really not used.

subprocess.run(["foot"], env=new_env, pass_fds=(fd,))

@WhyNotHugo
Copy link
Contributor

This runs foot as a test program. Replace this with any program compiled with a patched wayrs.

@WhyNotHugo
Copy link
Contributor

Tested with ./target/debug/examples/list_globals and seems to work fine 👍

@MaxVerevkin MaxVerevkin merged commit e136527 into main Feb 1, 2025
10 checks passed
@MaxVerevkin MaxVerevkin deleted the wayland_socket_env branch February 1, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support WAYLAND_SOCKET
2 participants