-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Use a wayland protocol for communicating layouts #112
Use a wayland protocol for communicating layouts #112
Conversation
9977865
to
7494b15
Compare
We also need to think about what happens when no layout client is running. My current idea is to get rid of the built-in "full" layout and instead place new windows at 0,0 (or maybe center), let them have their requested size, and don't touch existing windows. That probably simplifies things and has the interesting side-effect that river could be used as a floating compositor. |
That sounds reasonable to me. I'm fine with river basically being a minimal floating compositor by default with no layout client running. |
Commenting so we don't let it slide: we need to address the problem of switching between multiple layouts before committing to this protocol fully. A common use case would be using the default |
Actually there are two problems to solve here: How to switch between different layout generator clients and how to get arbitrary information from the user to a running client. The importance of the latter one can be demonstrated by an example: A user may want to switch the master position of rivertile (and running four instances of rivertile at the same time is a bit stupid IMO). A simple solution to both problems is just letting the user kill the current layout generator and exec a new one (or the same one but with different args). That however is not a very clean solution and should be avoided if possible IMO. I believe the first problem must be solved entirely in the compositor alone without any interaction with the client. The first problem may be solved with namespaces: When creating a For the second problem I see two approaches: 1) We add additional parameters to the layout requests, like |
Why don't we just send the request to the first client to register in the target namespace? then we don't waste the user's cpu time waking up all the layout clients that will be ignored anyways. |
Yeah that sounds reasonable. |
1004502
to
db47b8f
Compare
I have been over this again and have a few thoughts:
|
Hard nack, this would make the protocol dependent on the C ABI and there is no way for the scanner to scan arbitrary struct definitions out of the protocol code (for good reason). What we could and probably should do is provide example/skeleton code in a few popular languages to get people started, maybe even make it into a small library if it makes sense.
Totally agree there.
This seems like a reasonable approach to take. How should we handle the case where the client requests a namespace that is already in use then? I suppose we could make that a protocol error but that seems harsh as clients have no way of knowing what namespaces are in use. |
Yeah, I wasn't sure if it is possible, which is why I came up with the events in the first place. I prefer the skeleton approach. A library would be a bit more involved to support.
A protocol error is definitely too harsh. Also client could get different results (protocol error vs works as expected) when doing the exact same thing, which isn't a good thing IMO. Maybe it should be possible for a client to change its namespace whenever it wants (instead of just allowing it to be set at connection) and river would then send an "invalid namespace" (or a more generic "connection refused") event if the namespace is already used or unsuitable for other reasons. I don't think we can get around this communication step if we want to handle this cleanly. |
56366eb
to
2f62ee2
Compare
You are right, allowing clients to change their namespace at any time is probably racy. So maybe we don't allow that and when the namespace is invalid, the client can't do anything other than destroying the |
b2cb34d
to
5b0d18b
Compare
|
246c654
to
11829d0
Compare
11829d0
to
ab4581d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking very close to ready, there's still a bit of cleanup that can be done though.
2d23a66
to
93520e4
Compare
I think we have to rename "layout request" to something else, because technically it is not a request but rather an event. The current name is a bit confusing. |
d38bd13
to
31aee90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked at this patch again
true
That would mean that a views position when initially set to floating while a layout is active depends on whether it has been fullscreened earlier while no layout was active. Floating and fullscreen are from a UX perspective totally unrelated, so they should not form any causality chain in my opinion. Layout state being involved makes this even more awkward. |
I wasn't suggesting that we should set the |
Oh, yeah that's better. Though it would mean that after leaving fullscreen all views would snap the their |
Hmm, we can leave views that weren't fullscreen at their previous dimensions, but then it might be strange that only the fullscreened view ends up in its Maybe the approach you implemented is the best way to go, though we should |
6f632f7
to
3cea017
Compare
Changed the name. |
Anyway, I would like to "feature freeze" this PR now and only include your upcoming options change and strictly layout related bug fixes. What do you think about the git history? I think some commits maybe should be squashed. |
I'll do a pass over the commits just before landing this in master. I've got a few things to debug with the options changes before I push them. Would you mind updating the example C layout for the new options protocol? If you want to get started before I push you can find the xml here: https://0x0.st/-A9l.xml |
3cea017
to
a04361f
Compare
Great, I'll try to find some time tomorrow for the contrib layout. |
Alright, the initial implementation of Barring any bugs I'm unaware of, the current merge blockers are updating the contrib layout in C for river-options-v2 and reviewing the documentation/example init script. |
@ifreund Why should I destroy an undeclared option? To give context, I use this option to send commands to my client. It is cleared (I set it's value to null) after the command is interpreted so I'm notified of following one. |
The protocol has changed, options must be declared explicitly with one of the |
0bfd292
to
c7f94ea
Compare
Replace the current layout mechanism based on passing args to a child process and parsing it's stdout with a new wayland protocol. This much more robust and allows for more featureful layout generators. Co-authored-by: Isaac Freund <ifreund@ifreund.xyz>
Run the init command in a new process group and send SIGTERM to the entire group on exit. Without doing this, only the sh invocation used for the `sh -c` would receive SIGTERM. This is particularly useful when starting a per-session server manager as the init command.
Options are now all global but may be overridden per-output. If an output local value is requested but none has been set, the global value is provided instead. This makes for much better ergonomics when configuring layout related options in particular.
- Remove old layouts which no longer work. - Add new C layout.
cce0055
to
89aeda0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work on this @Leon-Plickat!
TODO:
if view dimensions on an output are set by a layout clientactive (meaning last used or pending) layout per output.With theack_layout_request
event, multiple layout clients can run side by side. River uses the one which send the ack first and ignores the others. Idea: maybe people want to implement different layouts as different clients.The serial in every request / event is needed because a layout client may be tasked with generating layout for multiple outputs simultaneously.