Skip to content
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

Unlock layout bias' upper limit #3439

Closed
resolritter opened this issue Apr 4, 2021 · 5 comments
Closed

Unlock layout bias' upper limit #3439

resolritter opened this issue Apr 4, 2021 · 5 comments

Comments

@resolritter
Copy link

Is your feature request related to a problem? Please describe.

Would it be feasible to allow bias above 90? As an experiment, I tried to modify the source code in the relevant places but it didn't make a noticeable difference. e.g. let's say 96

   def safe_increment_bias(old_val: float, increment: float) -> float:
  -    return max(0.1, min(old_val + increment, 0.9))
  +    return max(0.04, min(old_val + increment, 0.96))

  --- a/kitty/layout/splits.py
  +++ b/kitty/layout/splits.py
  @@ -253,7 +253,7 @@ def modify_size_of_child(self, which: int, increment: float, is_horizontal: bool
           if is_horizontal == self.horizontal and not self.is_redundant:
               if which == 2:
                   increment *= -1
  -            new_bias = max(0.1, min(self.bias + increment, 0.9))
  +            new_bias = max(0.04, min(self.bias + increment, 0.96))
               if new_bias != self.bias:
                   self.bias = new_bias
                   return True

  --- a/kitty/layout/tall.py
  +++ b/kitty/layout/tall.py
  @@ -69,7 +69,7 @@ def __init__(self, data: Dict[str, str]):
               b = int(data.get('bias', 50)) / 100
           except Exception:
               b = 0.5
  -        b = max(0.1, min(b, 0.9))
  +        b = max(0.04, min(b, 0.96))
           self.bias = tuple(repeat(b / fs, fs)) + (1.0 - b,)
           self.mirrored = to_bool(data.get('mirrored', 'false'))

The layout I used was:

enabled_layouts fat:bias=96;full_size=1

Describe the solution you'd like

Allow bias to be above 90. Unless there are implementation infeasibilities, to me it doesn't make sense to limit it; let the user deal with the consequences if there are any.

@kovidgoyal
Copy link
Owner

There has to be some limit, layouts are not designed to hide windows
completely other than the stack layout. So you would have to have some
limit less than 100. May I case what the limit of 90 is preventing you
from doing?

@resolritter
Copy link
Author

resolritter commented Apr 4, 2021

There has to be some limit, layouts are not designed to hide windows completely other than the stack layout.

Maybe it could be 99, then?

May I case what the limit of 90 is preventing you from doing?

Sure. I have a split which acts as a text input for sending commands to other splits, so ideally I'd have it really short. 90 is good already but I'd like to experiment with more... Maybe 94 or 96 as suggested.

@kovidgoyal
Copy link
Owner

kovidgoyal commented Apr 4, 2021 via email

@resolritter
Copy link
Author

resolritter commented Apr 4, 2021

It does feel like it's capped in other places indeed. Even with the patch I posted in the OP, I still cannot make shorter with manual resizes.

The proper fix for this is #2391

It's relevant for this to still be ratio-based instead of a fixed size. I didn't see a mention of "ratio" in that discussion although, if that's planned as well, alright.

This could be raised, however, as I said doing so will require careful testing/review.

I'm interested in the possibility of trying it out locally. Where more would I need to look at outside from the places I had already changed in the OP's patch?

@resolritter
Copy link
Author

Actually nevermind the ratio-based idea. I think fixed size would work out as well for this.

Closing in favor of #2391.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants