I really like Kitty but there are several things that keep me from abandoning iTerm and tmux.
One of them is the ability to zoom a window (like tmux's zoom pane).
Unless I missed something in the documentation, there is no such functionality in Kitty currently.
It would really be a neat feature to have.
simply switch to the stack layout. That will effective zoom the currently focused layout. You can create a dedicated key binding for it in kitty.conf if you like using the goto_layout function.
The zoom feature also allow to unzoom = go back to the previous layout. I see no previous_layout function in tabs.py.
Would you be open to a PR that implements this behavior ?
Switch back to the previosu layout and it is the same as unzoom.
If you mean you want an dedicated switch_to_previous layout function, sure, feel free to send a PR for that.
@pehota At the moment to almost get this behavior I did :
map `>z goto_layout stack
map `>a goto_layout tall
Thank you @ptbrowne and @kovidgoyal
with the "last_layout" implement, does that mean we now siwtch to stack, and then can toggle "last_layout" to get the zoom in/out effect?
yes
@kovidgoyal thanks for f0357b0 implementing last_used_layout.
Going one step further: because I typically switch between current layout and fullscreen ("stack"), it would be great to also have a toggle_layout_with_layout <layout> command, which would dispense having two keyboard shortcuts. I would map f11 toggle_layout_with_layout stack, and pressing F11 would always toggle between the current/previous layout and the stack layout. So no need to have one mapping for stack, and another for tall. A single toggle.
Edge case: if no previous layout exists at initial invoke and layout is stack, it's a noop.
Does that makes sense? Would you accept a PR for that?
I dont think you need aa separate function for that. Just modify last_used_layout to switch to a random layout if there is no previous layout, then you can simply use it for your use case.
Thanks for the last_layout implementation !
with the "last_layout" implement, does that mean we now siwtch to stack, and then can toggle "last_layout" to get the zoom in/out effect?
Is it possible to use the same key for zoom/unzoom ? Essentially having a conditional on the key ?
with the "last_layout" implement, does that mean we now siwtch to stack, and then can toggle "last_layout" to get the zoom in/out effect?
map `>z goto_layout stack if current_layout() != 'stack' else last_layout
I presume it is not possible to have a conditional in the config, is it be possible to add custom functions, usable in config ?
I don't think you need a separate function for that. Just modify
last_used_layoutto switch to a random layout if there is no previous layout, then you can simply use it for your use case.
@kovidgoyal the need is at startup: if there's no previous layout, then I'd like to switch to stack. Not to a random layout.
bind -n C-b resize-pane -Z, which have this toggling behavior between current layout and maximized layout.@ptbrowne 's suggestion about scripting in mappings would be neat too.
So instead of using a random layout, use the "next_layout" and set enabled_layouts to have stack as the number two layout, so that at startup it is the next_layout.
As for scripting in mappings, I'm afraid that is not going to happen. What you can do is create your own kitten, to do arbitrary scripting, kittens have access to the full kitty environment (the boss object from which you can create windows/siwtch windows/tabs/etc). The downside, with kittens is currently they will cause a brief flash when a overlay window is opened to run the kitten. It should be easy to modify the kittens sub-system to create kittens that have to running component and instead can just be used to script kitty, seamlessly. See https://sw.kovidgoyal.net/kitty/kittens/custom.html
So instead of using a random layout, use
next_layoutand setenabled_layoutsto havestackas the number two layout, so that at startup it is thenext_layout.
@kovidgoyal but then I still have to bind (and remember to use) _two_ keys: one to next_layout to stack on first use, and one to last_layout afterwards. Instead I'd like a _single_ key to toggle between current layout and "maximized".
What I also tried was to remove all layouts but tall and stack. In this case, next_layout becomes a real toggle between the two since they're the only two, but I also use other layouts intermittently, so that doesn't work.
It should be trivial to to create a kitten to do that for yourself. It's a little too specialised a use case for me to bother with creating a dedicated endpoint in kitty for it. I will instead modify the kittens system to allow no-UI kittens, so there will be no flash either.
I will instead modify the kittens system to allow no-UI kittens, so there will be no flash either.
Perfect, that was this that prevented me from using the kittens system. Thanks !
Most helpful comment
already done, https://github.com/kovidgoyal/kitty/commit/787100a4dcd3d9c338bfc15511e4a4824a865e6a