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

Allow remote control command to set layout state #3620

Closed
salmankhilji opened this issue May 13, 2021 · 1 comment
Closed

Allow remote control command to set layout state #3620

salmankhilji opened this issue May 13, 2021 · 1 comment

Comments

@salmankhilji
Copy link

Is your feature request related to a problem? Please describe.
I would like to set the layout state of a tab at creation time so that if I later decide to create windows within the tab, then the windows will magically appear in the exact sizes I want.

Describe the solution you'd like
I would like a new remote control command that allows me to set layout state (with the understanding that layout state is an internal kitty object and is subject to change at any time.)

Describe alternatives you've considered
My workaround is to first create the tab, then create some temporary windows within the tab, then resize the temporary windows to the way I like them, and then finally close the temporary windows. This is the script:

#!/bin/sh
id0=$(kitty @ launch --type=tab --keep-focus)
kitty @ goto-layout --match id:$id0 tall
id1=$(kitty @ launch --match id:$id0)
id2=$(kitty @ launch --match id:$id1)
kitty @ resize-window --increment=-13 --axis=vertical --match=id:$id2
kitty @ close-window --match id:$id1
kitty @ close-window --match id:$id2

Additional context
This is how my script would look like with the proposed remote control command:

#!/bin/sh
id0=$(kitty @ launch --type=tab --keep-focus)
kitty @ set-layout-state --match id:$id0 '{ "biased_map": { "1": -0.2 }, "main_bias": [ 0.5, 0.5 ], "num_full_size_windows": 1 }'
@kovidgoyal
Copy link
Owner

I dont think this is a good idea. Layout state is layout specific and is
very much an internal detail subject to change. As such it's not
suitable to expose via external API, without considerable work to make
it stable and robust to use, work I am not motivated to put in at this
point, and work that would also depend on implementing #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