mahkoh / jay

A Wayland Compositor
GNU General Public License v3.0
219 stars 11 forks source link

Multiple output configuration profiles for docked laptops #242

Open kennylevinsen opened 1 month ago

kennylevinsen commented 1 month ago

Laptops may be docked to more than a single setup, e.g. a home and work setup. These may require different output configurations, such as one having the laptop screen to the right of external screens, another having to the left or below external screens.

Jey currently only support per-output configuration with positive coordinates, and does not support dynamic configuration protocols that would allow kanshi and its profiles to work.

There are three main ways for a user to handle this:

  1. Dynamic configuration daemons like kanshi (or equivalent built-in functionality) that allow per-setup profiles to be applied.
  2. Place the laptop display at 0,0 and rely on both positive and negative positioning to place other displays statically around it.
  3. Place the laptop display arbitrarily deep into the global coordinate space so that the top-left-most display in any configuration is at 0,0, with other configurations leaving a top/left gap

Neither 1 or 2 is possible right now.

mahkoh commented 1 month ago

Jey currently only support per-output configuration with positive coordinates

This is deliberate bacause some downstream components cannot handle negative positions. I believe this affects both X and libei. But the user can just as well use 1000000x1000000 as their origin.

and does not support dynamic configuration protocols that would allow kanshi and its profiles to work.

There are two ways to handle this right now. You could use a shortcut to reconfigure your outputs via the configure-output action https://github.com/mahkoh/jay/blob/master/toml-spec/spec/spec.generated.md#action. Or you can write a config.so that handles this automatically https://docs.rs/jay-config/latest/jay_config/.

Place the laptop display arbitrarily deep into the global coordinate space so that the top-left-most display in any configuration is at 0,0

There is no requirement for 0x0 to be next to an output.

kennylevinsen commented 1 month ago

Yeah we allow negative coordinates in sway, but it upsets Xwayland indeed.

Building a config.so would be a possibility for this use-case, but coding the logic to configure outputs certainly seems like higher effort than e.g. kanshi profiles, especially when adjustments are needed. The convenience of loading such profiles could of course be coded within the config.so...

mahkoh commented 1 month ago

Adding support for the wlr protocol would be possible. I would prefer an upstream protocol but I should not ask for the impossible.

But I see a few issues.

The implementation would not be trivial because I currently don't do grouped device modifications. Instead individual requests are just passed into the backend and it either applies them or not.

My adaptive sync configuration is more sophisticated than a simple on off switch.

Jay does not support disabling outputs. It only supports disabling connectors and then they will appear as disconnected in the frontend. So the protocol could not be used to re-enable a connector.