"no space for new pane"" error when scripting tmux pane creation

381 views
Skip to first unread message

Sivaram Neelakantan

unread,
May 2, 2020, 12:09:46 PM5/2/20
to tmux-...@googlegroups.com
I was experimenting with scripting tmux via bash and I got the above
error at the fifth pane creation. I was under the impression that
tmux will auto resize panes to the smallest size and then issue such a
warning when it can no longer fit panes to the visible screen.

--8<---------------cut here---------------start------------->8---
#!/usr/bin/env bash

tmux start-server

tmux new-session -d -s MySession -n Shell1 -d "/usr/bin/env bash -i"
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux split-window -t MySession:1 "/usr/bin/env bash -c \"echo 'fifth shell'\"; /usr/bin/env bash -i"
tmux select-layout -t MySession:1 tiled
--8<---------------cut here---------------end--------------->8---

4 panes got created though and I was within the tmux session after
running the script.

How do I fix this? Relatedly, how do I generalise the script for
various screen sizes of laptops and other screens to fill it up with
panes of a certain size?

sivaram
--

Nicholas Marriott

unread,
May 2, 2020, 12:14:13 PM5/2/20
to Sivaram Neelakantan, tmux-...@googlegroups.com
On Sat, May 02, 2020 at 09:39:37PM +0530, Sivaram Neelakantan wrote:
> I was experimenting with scripting tmux via bash and I got the above
> error at the fifth pane creation. I was under the impression that
> tmux will auto resize panes to the smallest size and then issue such a
> warning when it can no longer fit panes to the visible screen.

No, this has never been the case, tmux will split a pane if it is big
enough to split into two without moving other panes.

>
> --8<---------------cut here---------------start------------->8---
> #!/usr/bin/env bash
>
> tmux start-server
>
> tmux new-session -d -s MySession -n Shell1 -d "/usr/bin/env bash -i"
> tmux split-window -t MySession:1 "/usr/bin/env bash -i"
> tmux split-window -t MySession:1 "/usr/bin/env bash -i"
> tmux split-window -t MySession:1 "/usr/bin/env bash -i"
> tmux split-window -t MySession:1 "/usr/bin/env bash -c \"echo 'fifth shell'\"; /usr/bin/env bash -i"
> tmux select-layout -t MySession:1 tiled
> --8<---------------cut here---------------end--------------->8---
>
> 4 panes got created though and I was within the tmux session after
> running the script.
>
> How do I fix this? Relatedly, how do I generalise the script for
> various screen sizes of laptops and other screens to fill it up with
> panes of a certain size?

The easiest things to do are to either make the session big enough to
fit all the panes even when they are split:

tmux new -d -x 200 -y 200 ...

Or to apply the tiled layout after every split (this is what I tend to
do):

tmux splitw -tMySession:1 ... \; selectl tiled

Sivaram Neelakantan

unread,
May 2, 2020, 12:39:11 PM5/2/20
to tmux-...@googlegroups.com
On Sat, May 02 2020,Nicholas Marriott wrote:


[snipped 30 lines]

> The easiest things to do are to either make the session big enough to
> fit all the panes even when they are split:
>
> tmux new -d -x 200 -y 200 ...
>
> Or to apply the tiled layout after every split (this is what I tend to
> do):
>
> tmux splitw -tMySession:1 ... \; selectl tiled

I still get the same error with these changes; what am I doing wrong?

--8<---------------cut here---------------start------------->8---

tmux new-session -d -s MySession -n Shell1 -d "/usr/bin/env bash -i"
tmux split-window -t MySession:1 "/usr/bin/env bash -i ; selectl tiled"
tmux split-window -t MySession:1 "/usr/bin/env bash -i ;selectl tiled"
tmux split-window -t MySession:1 "/usr/bin/env bash -i ;selectl tiled"
tmux split-window -t MySession:1 "/usr/bin/env bash -c \"echo 'fifth shell'\"; /usr/bin/env bash -i ;selectl tiled"
tmux select-layout -t MySession:1 tiled
--8<---------------cut here---------------end--------------->8---


sivaram
--

Nicholas Marriott

unread,
May 2, 2020, 12:42:41 PM5/2/20
to Sivaram Neelakantan, tmux-users
You need a \ before ; so it gets passed to tmux rather than interpreted by the shell.

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/krpqx3h7wyjnq3.fsf%40gmail.com.

Sivaram Neelakantan

unread,
May 2, 2020, 1:49:40 PM5/2/20
to tmux-...@googlegroups.com
On Sat, May 02 2020,Nicholas Marriott wrote:

> You need a \ before ; so it gets passed to tmux rather than interpreted by the shell.
>

[snipped 17 lines]

>
> --8<---------------cut here---------------start------------->8---
>
> tmux new-session -d -s MySession -n Shell1 -d "/usr/bin/env bash -i"
> tmux split-window -t MySession:1 "/usr/bin/env bash -i ; selectl tiled"
> tmux split-window -t MySession:1 "/usr/bin/env bash -i ;selectl tiled"
> tmux split-window -t MySession:1 "/usr/bin/env bash -i ;selectl tiled"
> tmux split-window -t MySession:1 "/usr/bin/env bash -c \"echo 'fifth shell'\"; /usr/bin/env bash -i ;selectl tiled"
> tmux select-layout -t MySession:1 tiled
> --8<---------------cut here---------------end--------------->8---

Putting a slash before ; resulted in 4 panes showing up briefly and
it all went away to be replaced with a single pane. Upon exit, same
error message was there.

The one below worked and I got 5 panes with the last pane taking up the full
screen width at the bottom.

--8<---------------cut here---------------start------------->8---
tmux new-session -d -s MySession -n Shell1 -d "/usr/bin/env bash -i"
tmux select-layout -t MySession:1 tiled
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux select-layout -t MySession:1 tiled
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux select-layout -t MySession:1 tiled
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux select-layout -t MySession:1 tiled
tmux split-window -t MySession:1 "/usr/bin/env bash -i"
tmux select-layout -t MySession:1 tiled
--8<---------------cut here---------------end--------------->8---

This is on 3.1b.



sivaram
--

Nicholas Marriott

unread,
May 2, 2020, 1:57:58 PM5/2/20
to Sivaram Neelakantan, tmux-users
You need to put the " \; selectl tiled" outside the quotes, it is a
separate tmux command, not part of the bash command.
> --
> You received this message because you are subscribed to the Google Groups "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/krpqx3a72qi5w6.fsf%40gmail.com.

Sivaram Neelakantan

unread,
May 3, 2020, 6:03:34 AM5/3/20
to tmux-...@googlegroups.com
On Sat, May 02 2020,Nicholas Marriott wrote:

> You need to put the " \; selectl tiled" outside the quotes, it is a
> separate tmux command, not part of the bash command.
>

aargh. Yes, that worked. Sorry.

[snipped 41 lines]


sivaram
--

Reply all
Reply to author
Forward
0 new messages