-
Notifications
You must be signed in to change notification settings - Fork 0
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
Alternative (non-CLI) Socket Handover Mechanisms #2
Comments
Heres my 2ct on this:
Even though I dislike environment variables for their implicit behaviour, I think the |
Right, makes sense. I would still support this as an alternative to not break compatibility so early.
Yeah, the options are nice, but it doesn't really work in their cases. I would only go for this if some compositors are absolutely against env vars, in which case I would support both env vars and CLI options.
Socket activation can also be used to allow dependent services to start up in parallel. I tried to launch Sway as a systemd user service once, and had an issue where sometimes services like
Yes, these env vars are basically a direct translation of the CLI options to env vars. Main disadvantage with this over the CLI is that if the compositor doesn't support it, those env vars (and the socket FD!) will leak to all clients in the session. Unknown CLI options are much less likely to be silently ignored (counterexample: cosmic-comp completely ignores its args and the socket would leak even if the CLI option is used if cosmic doesn't support socket handover). Thanks for the feedback! I'm still quite interested in what compositor developers have to say to this, since they are ultimately who will have to consume this API. |
It could be useful when |
I recently tested LXQt + Kwin with both |
Yes, tested again for good. |
Tested now with But using hot corners on kwin_wayland to make it crash can lead also to a complete block of any input and the need of a hard reset. Happened twice now... |
I agree the naming of the CLI flags is not super consistent ( |
Now that you mention it, you're right, One issue with having the parent set |
Hm right that's a good point… Other options would include:
|
A challenge to think about is FD's from wayland security-contexts. We need not just one FD, but many, with metadata and dynamically changing. There's a bunch of options to fixing this, we (kwin) were trying a port to Systemd's FD store. It's basically an API to dynamically give it an FD and a name, then get them back. I'm not sure how well that fits into here. It means you have a standard third party program has all the FDs, but I don't think it'll share them if you swap what you're launching. |
Thanks for the insight! Security contexts are something I didn't think about when making this. |
I think the security-context stuff is less of an issue because it's all contained inside each compositor impl, no? IOW: when being restarted it's up to the compositor to grab any previous security-context FD from the systemd store or anywhere else, and tools such as wl-restart don't need to do anything special. |
Regarding FD store: IIUC file descriptors previously stored in the systemd FD store are passed back to the application by systemd on restart using extra entries in
|
So my takeaway from the discussion up until now is that there are significant reasons to choose |
gamescope uses |
Couldn't the wrapper:
|
In that case there'd be no need for a wrapper, since its whole purpose is restarting the compositor, which it can't do if it exec()s itself away. Just creating the wayland socket and moving it to the FD store is certainly a thing that can be done (maybe potentially needed for the lock file?), but I'm not sure if it's worth the complexity, since it would rely on systemd anyway. I see two (maybe three) use-cases:
Not sure if I interpret this correctly, I'm open to suggestions and corrections. |
Thanks, didn't know about that one. Another possibility would be fd names |
I have a WIP doing that. https://invent.kde.org/plasma/kwin/-/merge_requests/6270 There's a few tiny annoying details that makes implementations not trivial:
|
So as I gather the main questions with
|
FYI: I just published wl-restart 0.3.0 with added support for the I will likely work on integrating and fleshing out |
A simple solution for this situation:
FD is the number of the file descriptor for the socket that is being passed to the compositor. Example usage:
Pros:
Cons:
|
The current handover mechanism is based on the CLI options that Kwin uses for socket handover and not on any agreed-upon standard. These CLI arguments are inconsistently named (
--socket
vs--wayland-fd
) and also have a CLI option format that not all compositors share (River uses single dash CLI options, cosmic-comp currently has no CLI parsing at all).This means that there is a need for a different socket handover mechanism. Options include:
--wayland-socket
and--wayland-fd
)LISTEN_PID
,LISTEN_FDS
,LISTEN_FDNAMES
with the fd as file descriptor 3.LISTEN_FDNAMES
is also used by other fd passing and we should use a generic name likewayland
)WAYLAND_SOCKET_NAME
,WAYLAND_SOCKET_FD
The text was updated successfully, but these errors were encountered: