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

compositor: implement wayland socket handover #6930

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

Ferdi265
Copy link
Contributor

@Ferdi265 Ferdi265 commented Jul 19, 2024

Describe your PR, what does it fix/add?

This PR implements the compositor side of the Wayland socket handover protocol as described in the KDE Wiki. The CLI options are chosen so that they are compatible with Kwin:

Hyprland now accepts the CLI options --socket NAME and --wayland-fd FD, which pass the name of the Wayland display socket and the Wayland display socket fd number respectively. If given, Hyprland will use these instead of finding a free Wayland display socket name and creating it.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

This allows for Hyprland to be used with a helper tool that automatically restarts the compositor on crashes, and allowing clients to reconnect after the compositor restart and survive the crash. The reconnecting clients look like new clients to Hyprland and perform all the same steps as a fresh Wayland client would. No additional handling is required on the side of Hyprland.

The helper tool finds and creates the Wayland socket and launches Hyprland with the new CLI options, restarting it when it exits with a non-zero exit code. Two such helper tools currently exist as far as I know:

Is it ready for merging, or does it need work?

This PR works well from my personal testing.

src/main.cpp Show resolved Hide resolved
vaxerski
vaxerski previously approved these changes Jul 19, 2024
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

src/main.cpp Outdated Show resolved Hide resolved
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

src/main.cpp Outdated Show resolved Hide resolved
src/Compositor.cpp Outdated Show resolved Hide resolved
src/Compositor.cpp Show resolved Hide resolved
@Ferdi265
Copy link
Contributor Author

rebased onto latest main

vaxerski
vaxerski previously approved these changes Jul 19, 2024
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@vaxerski
Copy link
Member

oopsie, someone didn't run clang-format :P

@Ferdi265
Copy link
Contributor Author

oopsie, someone didn't run clang-format :P

Ahh sorry, should be correct now.

This commit implements the compositor side of the Wayland socket
handover protocol as described in the [KDE Wiki]. The CLI options are
chosen so that they are compatible with Kwin.

[KDE Wiki]: https://invent.kde.org/plasma/kwin/-/wikis/Restarting
@Ferdi265
Copy link
Contributor Author

also, cleaned up the history.

@vaxerski vaxerski merged commit efccf25 into hyprwm:main Jul 19, 2024
11 checks passed
@Ferdi265 Ferdi265 deleted the feature-socket-handover branch July 19, 2024 22:51
@Ferdi265
Copy link
Contributor Author

Note: Labwc has voiced some concerns on standardizing on these particular CLI options for socket handover.

I created a discussion issue for figuring out a mechanism for socket handover that more compositors can agree on in this wl-restart issue.

These CLI options will continue to be supported by wl-restart (likely indefinitely), and will continue to be the default for the time being.

Alternative socket handover mechanisms could possibly bring support for Systemd socket activation for Wayland compositors in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants