Amethyst icon indicating copy to clipboard operation
Amethyst copied to clipboard

Support for horizontal window resizing, not just vertical

Open gprimosch opened this issue 11 years ago • 17 comments

One feature I would like is to be able to proportionally resize a window within the left or right columns.

Example: I have two windows in my left (primary) column, each taking 50% of the space. I then press mod2 + j to resize the focused window to be 70% of the column.

Likewise, if I have three windows open in my right (secondary) column, they start out as each having 33% of the window. After pressing mod2 + j, I resize the top one to be 50%, so the remaining two windows have 25% each.

Trello Card

gprimosch avatar Nov 07 '13 20:11 gprimosch

This would probably have to be a more sophisticated tall layout.

ianyh avatar Nov 11 '13 01:11 ianyh

Just to make clear, what we are incrementing for each window is a weight. Default weight = 1. Add 0.2 to the weight for each press of mod2 + l. Subtract 0.2 for each press of mod2 + h with a floor of .2. (Alternatively, multiply by 1.25 or .80, respectively). When determining window heights, normalize the weights as a percent height:

height[i] = screenheight * weight[i] / sum(weight[])

Thus the only hard thing is keeping track of each each window.

gprimosch avatar Nov 11 '13 20:11 gprimosch

Interesting, since we keep track of the windows in an array, one way would be to keep a mirrored array with the corresponding indexes mapping to their weight.

leonardt avatar Nov 19 '13 05:11 leonardt

It might be easier to track it as a property on the window directly like we do with floating. Just track a window weight and have layouts that use it in whatever way is desired.

ianyh avatar Nov 19 '13 15:11 ianyh

This is a feature I would very much like to see as well. Coming from i3, this missing feature is perturbing :)

AdrienLemaire avatar Jul 04 '16 07:07 AdrienLemaire

This is what I miss most from using xmonad on linux, would love to see this happen!

vespakoen avatar Sep 30 '16 12:09 vespakoen

There doesn't seem to be a data structure in place for subdividing the areas, just a single "ratio" as defined by the protocol.

As an attempt, here is a snippet that I considered during development of #627 (but was eventually scrapped in favor of the ResizeRules struct).

/*
 A tiling window manager must have some concept of constraint:
  a "primary" frame boundary bisects the entire screen, with
  successive boundaries bisecting less than or equal distances
  (e.g. BSP would bisect the full screen, 1/2, then 1/4...
   but a column layout would bisect full, full, full, etc)

 This data set captures the "rank" of a frame, and each constraint.
  - a "primary" frame on a layout like "Tall" will be [horizontal]
  - a "secondary" frame on a layout like "Tall" will be [horizontal, vertical]
  - a "secondary" frame on a layout like "Column" will be [horizontal, horizontal]
  - a "tertiary" frame on a layout like "Middle" will be [nil, horizontal, horizontal]

 Note that in practice, the only values that matter are the max-indexed horizontal
 and vertical values. Hence, values are optionals.
   i.e. [horizontal, horizontal, horizontal] equates to [_, _, horizontal]
        [vertical, vertical, horizontal, horizontal] -> [_, vertical, _, horizontal]

 Additionally, we include the number of frames in that frame rank -- there may be multiple
 primary or secondary or tertiary frames sharing the same space.
 */
typealias FrameConstraint = (unconstrainedDimension: UnconstrainedDimension?, frameCount: Int)
typealias RankedConstraintList = [FrameConstraint]

ianfixes avatar Nov 17 '17 17:11 ianfixes

+1 for adjusting height of tiles!

sonn-gamm avatar Dec 02 '18 16:12 sonn-gamm

bump

Mcilie avatar May 14 '20 23:05 Mcilie

Would definitely love to see this feature as well!

albingroen avatar Jul 07 '20 07:07 albingroen

Would love to see this!

erdostom avatar Sep 16 '20 14:09 erdostom

Big ➕

andreasvirkus avatar Jan 06 '21 20:01 andreasvirkus

Well, a big ➕ by me too, coming from i3 it seems an essential feature to have, are there any workaround ?

paolomainardi avatar Feb 01 '21 15:02 paolomainardi

Yabai supports this feature (https://github.com/koekeishiya/yabai)

vespakoen avatar Feb 01 '21 15:02 vespakoen

Thanks a lot @vespakoen i'll give it a try!

paolomainardi avatar Feb 01 '21 15:02 paolomainardi

Here is my (old) config that mimics monad a bit in case it's useful: https://github.com/koekeishiya/yabai/issues/295

vespakoen avatar Feb 01 '21 16:02 vespakoen

I think this should be possible now with #1134.

ianyh avatar Jul 02 '22 03:07 ianyh

Has anyone had success implementing this using a custom layout? Bonus points if you are using a tall layout for it.

majjoha avatar Feb 13 '23 17:02 majjoha

For what it's worth, I think this is a case for a more fully featured binary space partitioning, which is possible with a custom layout, but yabai is bsp out of the box.

It would be interesting if someone did do full bsp as a custom layout, but I think I will close this as it is probably outside of the scope of the native app.

ianyh avatar Mar 01 '23 13:03 ianyh