Open emersion opened 4 years ago
X RandR has a "primary output" concept. The doc has this to say:
RRSetOutputPrimary marks 'output' as the primary output for the screen with the same root window as 'window'. [...] This request is expected to be used by desktop environments to mark the screen that should hold the primary menu bar or panel.
Could sway (or Wayland) develop a similar concept? Then layer-shell should have a way for applications to request display on the "primary" output. Maybe the primary output concept could be reused with other privileged protocols, like XWayland, where some clients may wish to use the randr primary output. Seems like a boon for both compatibility and feature parity.
Unlike randr, I don't think there is any need to allow general clients to set the primary output. Sway can do that on it's own w/ config. Though wlr-output-management might want to allow it.
layer-shell should have a way for applications to request display on the "primary" output
There's already a way for clients to let the compositor pick the most appropriate output. No need for protocol changes.
I'm not so sure.
Like you said, the default output is currently the output with focus. I don't think changing the default to match the "primary" is always right. In my mind, there are different requirements.
wofi is an example of an app that should appear on my focused output. swaybar is an example of an app that (if so configured) should appear on my "primary" monitor.
If my focus changes, an open wofi should not move to the newly focused monitor. If my primary monitor changes swaybar should be moved to the new primary output. The description of RRSetOutputPrimary seems to anticipate this behavior by generating events that clients can watch for. In Wayland, we will just move privileged clients that have requested the "primary" output to the new output and send enter/configure events ourselves.
Actually, i3bar already supports xrandr primary with output primary. swaybar doesn't support that, but it could! A hypothetical use-case would be if I plug my laptop into a dock, I want my desktop monitor to become my new primary and my bar will move there. In X, autorandr can do that for i3. In sway we could extend wlr-output-management to allow a daemon like kanshi to do the same.
I don't think changing the default to match the "primary" is always right.
I suppose the means "primary" monitors are actually a totally separate feature request.
The default layer-shell output is the output having focus right now. We could let users specify an explicit output name instead.