What's the tmux layout string format in which I can define my custom layout? When I run tmux list-windows
in a tmux session it gives me something like:0: bash* (2 panes) [186x52] [layout 294a,186x52,0,0{93x52,0,0,185,92x52,94,0,186}] @113 (active)
But I want to know what is the format so I can create my custom format to be loaded by something like tmuxp in a config file when starting a new session. I searched the tmux man page and Googled but could not find anything.
Asked
Active
Viewed 858 times
0

Masked Man
- 2,176
- 2
- 22
- 41
-
As an alternative, look at perl [tmuxlayout](https://metacpan.org/pod/tmuxlayout) and [tmuxinator](https://github.com/tmuxinator/tmuxinator), which can help with layouts. – meuh Dec 23 '19 at 17:57
2 Answers
3
The way to create your own custom layout is to set the layout in tmux using the key bindings or commands, and then use "tmux lsw" to get the layout string.
They are not intended to be constructed any other way.

Nicholas Marriott
- 3,148
- 9
- 12
3
layout 294a,186x52,0,0{93x52,0,0,185,92x52,94,0,186}
↑checksum ↑pane size | another pane size + coord + id
↑window size ↑pane coord
↑pane id
So for this layout, it contains two panes:
- 93x52, align at x=0,y=0 and id is %185
- 92x52, align at x=94,y=0 and id is %186
Edit:
- The first 4 hex digits are a checksum, you can find a Perl implementation in: https://metacpan.org/dist/Term-Tmux-Layout/view/bin/tmuxlayout
- The pane id-s are not relevant, for example if replaced with 0 or mixed up at random (and checksum adjusted as well) select-layout will work just like before. This is a missed opportunity, because:
- The panes - ordered by pane indices - are placed one for each complete (size,coord1,coord2,id) tuple found in the layout. Unfortunately some tmux commands like move-pane, redistribute pane indices, so they are not as permanent as pane id-s.