Ability to define split layouts #2480
Replies: 22 comments 22 replies
-
|
I converted this to a discussion to gather some more feedback and design the configuration style and so on. I'm supportive of this feature but I think it needs to be slightly better defined in the context of Ghostty before we go off and make an issue. You didn't do anything wrong, just noting my decision making process. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
To kickstart the discussion, I'd personally like to be able to have something like the following: A new action named
I'd also like to see some configurations for adjusting the width/height. These would be a # of columns or a
This is all largely based off of how tmux handles this. I could also see the height/width being arguments on the |
Beta Was this translation helpful? Give feedback.
-
|
For examples from other applications that support this type of tiling behavior:
I agree with @scnewma's suggestions, as the basic idea is one main pane and N supporting panes, with the ability to swap between layouts with a command and resize the main size. It would also be nice to see middle main pane (supporting on sides) and binary space partitioning. |
Beta Was this translation helpful? Give feedback.
-
|
Coming from kitty, I like the idea of setting a preferred split-pane layout. This way, I can bind a single keybind to create a new split (and I know where it's going to land). I personally use the |
Beta Was this translation helpful? Give feedback.
-
|
I'd also love a similar feature. Coming from kitty, that's one of the rare "missing" features for me. Personally, I tend to use 3 layouts: grid (balanced grid with each pane taking up roughly the same space), vertical and horizontal (all panes in a column/row, balanced in size). To get there, I see 2 problems with ghostty. First, the current split strategy systematically creates a new level of depth in the tree. For instance, split right twice in a new window, you get Some people want that, that's fine. But an equally valid choice would be to create new levels only as needed. In the same "split right twice" example, one could expect to get I believe this change alone would make kitty's vertical/horizontal/tall/fat layouts and most of the main+support models described above trivial to do "by hand". Regarding more complex layouts like grid, the issue is that I don't think you can't do them trivially by hand. Even with the first problem above solved to eliminate the need for the The only way I can think of to make it trivial is to have the terminal define the rules and logic of each layout ahead of time, and not have users recreate them by hand every time. In that regard, I think kitty has a decent approach. There's a And in terms of configuration / user interaction, it works really nicely. At least I don't see how to do much simpler or more efficient for the user:
For reference: https://sw.kovidgoyal.net/kitty/layouts/ |
Beta Was this translation helpful? Give feedback.
-
|
I've written a utility that manages specific sessions and layouts in tmux, currently working on a "driver" for zellij. Not sure yet how useful it will be but I am using the process of adding this functionality to refactor the codebase. Long story short, I'd love to be able to script ghostty to allow native layouts without needing a multiplexer like tmux or zellij. |
Beta Was this translation helpful? Give feedback.
-
|
another user of kitty's also related would be a way to define a "main" split and be able to move the current focused split into "main" with an action like |
Beta Was this translation helpful? Give feedback.
-
|
I do something somewhat similar with Ghostty(previously Alacritty)/Tmux/Tmuxinator. It allows for preconfigured layouts/commands. ---
# name: Multi
name: Multi <%= rand(65536) %>
startup_pane: 0
windows:
- ✖:
layout: 92fd,168x42,0,0{83x42,0,0[83x13,0,0,0,83x13,0,14,1,83x14,0,28,2],84x42,84,0[84x13,84,0,3,84x13,84,14,4,84x14,84,28,5]}
panes:
- # local
- # local
- ash:
- ssh ash
- lg:
- ssh deskg
- na:
- ssh lapn
- dn:
- ssh kandarianWould be great to have something like this in Ghostty as I'm mainly using it for the layout and broadcasting commands(which can sort of be done with I'm guessing however that it would require a lot of work. Technically I can do something similar with ydotool(xdotool) but it's incredibly janky. |
Beta Was this translation helpful? Give feedback.
-
|
I've written a session and layout manager for tmux and I've also added experimental zellij support. You can specify pretty accurate layout configurations that go beyond what tmux offers out of the box. I borrowed the flex-box analogy from front end layout engines. It would be great to also add Ghostty as another potential multiplexer into the mix... So I'm all for a programatic interface to managing tabs and panes within Ghostty. |
Beta Was this translation helpful? Give feedback.
-
|
I stumbled into the Discord looking for a way to have a quick window split by default. So here is my +1 for some sort of default layout controls. I'd be stoked with just a |
Beta Was this translation helpful? Give feedback.
-
|
@mitchellh I recently found Ghostty and I wanted to share an idea for a config option like this: The challenge is how to define the split layouts so they are easy to understand but flexible enough for most people. After a bit of inspiration I came across this idea of naming it after the direction of the splits. I think it ended up quite nice. Eastward: The split count in the west-to-east direction: This generalizes to more columns eastward, but I won't show all of them: Southward: The split count in the north-to-south direction: This generalizes to more rows southward, but I won't show all of them: Curious if this layout naming scheme makes sense to you. I tried several naming approaches: To start I'd probably hardcode layouts for up to 4-4-4 for both eastward and southward directions (64 each), so easy to configure with a single string constant and significantly more powerful than other terminals. Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
|
Has anyone found a workaround for Ghostty not supporting split layout profiles / defaults? Coming from iTerm where I always defaulted to a 2x2 grid it would be great to have this in Ghostty |
Beta Was this translation helpful? Give feedback.
-
|
Hey, I believe a good layout configuration system could be very useful. Ghostty already supports tabs and splits and layout feature could be a game-changer! I currently using a script to open my default layout: tab 1 with neovim, tab 2 with servers and logs with a horizontal split and lazydocker running in one of them, and 3rd tab for git, lazygit and other things. My script uses ydotool to send keys and open a new tab, or a split, or type a command. ghostty could have a default layout with one tab, and could be opened with a specific layout like: ghostty --layout dev.layout or ghostty -l dev.layout |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
|
Personally, I want this so I can give Claude Code more control of my experience - I want it to be able to open splits to show me images or text files as we're chatting. |
Beta Was this translation helpful? Give feedback.
-
|
After more thinking I think the solution must mirror the UI functionality of selecting regions and choosing horizontal or vertical splits. It turns out splitting is easy, so the real issue is syntactically choosing the next region to split. To this end I propose a space separated list that chooses the coordinates (25-50), horizontal split (h) or vertical split (v). For example: “v 25-50 hhh 75-25 vv” This means start with initial region and do one vertical split (v) Then select region at 25%-50% coordinates and do three horizontal splits (hhh) Finally select region at 75%-25% coordinates and do two vertical splits (vv) The list can be any length handling all layouts, and I think most examples would be about 10-20 characters for most people. What do you all think? |
Beta Was this translation helpful? Give feedback.
-
|
Sounds confusing. Whatever solution you do can you just add a “save current layout” |
Beta Was this translation helpful? Give feedback.
-
|
Yes, it should definitely have a way to save the layout. As for confusion: there aren’t many good ways to indicate which region. Either you use region index or use a coordinate to find it by position. Region is hard because the splits add more regions so it’s hard to guess which is which. Coordinates are hard because if you do pixels then your layout might come out differently based on the initial window size (hence choosing percents to be constant). So it comes down to two choices. Percent coordinates: Or region indexes, which will feel a bit arbitrary but look simpler: Clearly, the second is easier to code and both require a bit of trial and error to get right so I don’t have a strong preference :) What I am 100% sure of is this fully expresses all layouts, and that that is rare enough other terminals can not do it. |
Beta Was this translation helpful? Give feedback.
-
|
+1 for this! I spend most of my day in Ghostty with Claude Code and usually end up with the same layout every time. Right now I'm manually splitting every session which gets old fast. Honestly, even just a default-layout config that restores a basic split setup on launch would cover 90% of my use case. Something like zellij's declarative approach with per-pane commands would be the dream though - being able to ghostty --layout dev and have everything ready to go would be huge. Would love to see this land in any form. |
Beta Was this translation helpful? Give feedback.
-
|
For all the recent comments in this thread Github discussions have a arrow that show you want this feature it even bumps the thread to the top of the discussions for recent activity and it doesn't send a email to everyone, use that instead if you don't have an idea of how the configuration should look or some detail that may be useful (like an example of how kitty does it) window-save-state is not the solution for this
that is a entirely separate discussion #2353 which honestly might cover creating layouts programmatically in the long term as its more generic. Zellij example was already listed above #2480 (comment) the Zellij configuration style is highly unlikely to make its way into ghostty as it completely deviates from the current configuration syntax of This discussion also has some comments on saving a current layout, to be clear from my perspective that is a entirely separate feature request which relies on the ability to even define layouts in the first place as such it should be its own discussion |
Beta Was this translation helpful? Give feedback.
-
|
Totally agree that grids like 2x3 and 2x4 should be easy to express. That's exactly what this proposal enables: The real power is in a layout like Kitty "splits" layout: In this layout system splits would look like And here's step by step why this works: Once you can describe any layout as a string, the rest is easy: a config setting for the default layout, keybindings to switch between layouts, and so on. |
Beta Was this translation helpful? Give feedback.
-
|
I think the split layout is concise. However, I believe this "Layout" system is incomplete, i know the title is about 'split layout' but a real-world workflow usually requires:
I suggest extending the syntax by introducing a tab (t) and attribute blocks ([]). Example Syntax Compatibility: If you don't use t or [], the syntax remains identical to the original proposal. |
Beta Was this translation helpful? Give feedback.




Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
One of the features that I cannot live without with
tmuxis it's layout feature. This feature allows for panes to be automatically laid out with a given width/height.AFAICT, I cannot reproduce this behavior with Ghostty, but would really love it so that I could use ghostty without tmux.
To provide additional context for my workflow, I use tmux's
main-verticallayout, when I add a new pane I automatically targetbottom-left. This allows my new splits to always be outside of the "main" pane, with the height of the new panes always being evenly split (I accomplish this by "reselecting" the layout via hooks).Beta Was this translation helpful? Give feedback.
All reactions