'Inconsistent window behavior on tmux startup

I'm using iTerm2's hotkey window to open a default set of tmux panes whenever I first launch the window. I have a file named .hotkeyconfig I'm using to source the commands necessary to size the window.

tmux new -s hotkey \; \
select-pane -t 0 \; \
split-window -h  \; \
resize-pane -t 0 -L 34  \; \
split-window -h  \; \
resize-pane -L 15  \; \
split-window -h  \; \
resize-pane -R 19  \; \
select-pane -t 1  \; \
split-window -v  \; \
resize-pane -U 2  \; \
resize-pane -R 10  \; \
select-pane -t 0  \; \

I call this when the window starts with:

source ~/.hotkeyconfig

When there's another attached tmux session using this command produces the top result, however if the hotkey window is the only attached tmux session, it produces the output on the bottom.

output

What is causing this inconsistent behavior and how can I fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source