WillPower3309 / swayfx

SwayFX: Sway, but with eye candy!
MIT License
1.29k stars 48 forks source link

Alternate partitioning schemes for split #149

Closed tyush closed 1 year ago

tyush commented 1 year ago

Although a pretty far stretch, alternate partitioning schemes for window space, such as bspwm's binary space partitioning, would allow for more efficient usage of screen space based on a user's preferences. Sway already has support for nesting schemes through splith and splitv, turning a window into what's effectively a "nested workspace", able to use a different scheme than it's parent. This enhancement would ideally allow for a strategy defined in a user's config for where a new window should be placed, potentially splitting an existing window.

Wishlist for strategies: (number is order windows were created, 1 being first) Binary tree (latest window region is split for new window)

+---------------+------------------+
|               |                  |
|               |        2         |
|               |                  |
|               +--------+---------+
|        1      |        |         |
|               |        |         |
|               |    3   |    4    |
|               |        |         |
|               |        |         |
+---------------+--------+---------+

Inverse binary tree (newest window is given half of the screen)

+---------------+------------------+
|               |                  |
|               |        3         |
|               |                  |
|               +--------+---------+
|        4      |        |         |
|               |        |         |
|               |    2   |    1    |
|               |        |         |
|               |        |         |
+---------------+--------+---------+

Rectangular (prioritizes maintaining aspect ratio)

+----------------+-----------------+
|                |                 |
|        1       |        2        |
|                |                 |
|                |                 |
+----------------+-----------------+
|                |                 |
|        3       |        4        |
|                |                 |
|                |                 |
+----------------+-----------------+

Horizontal (newest window is given half the screen, splitting the screen between the window and the rest of the windows arranged horizontally)

+-----------------+-------+---+----+
|                 |       |   |    |
|                 |       |   |    |
|                 |       |   |    |
|                 |       |   |    |
|        4        |   3   | 2 | 1  |
|                 |       |   |    |
|                 |       |   |    |
|                 |       |   |    |
|                 |       |   |    |
+-----------------+-------+---+----+
ErikReider commented 1 year ago

Wouldn't something like https://github.com/nwg-piotr/autotiling be a better fit rather than complicating the already complicated Sway layout code? @WillPower3309 any ideas?

WillPower3309 commented 1 year ago

Wouldn't something like https://github.com/nwg-piotr/autotiling be a better fit rather than complicating the already complicated Sway layout code? @WillPower3309 any ideas?

Yeah, generally we only accept things that aren't possible with the sway ipc. I've mostly focused on the rendering side where position and size are known, but that said, if there's an easy and minimal way to support other layouts I wouldn't be opposed to the idea! I just don't know if it can be done in such a way

tyush commented 1 year ago

Wouldn't something like https://github.com/nwg-piotr/autotiling be a better fit rather than ...

Ah, I hadn't seen that tool before; it appears to do exactly what I was describing in the request. Thanks!