diff --git a/tmux-daemon.sh b/tmux-daemon.sh index 070077f..40331ee 100644 --- a/tmux-daemon.sh +++ b/tmux-daemon.sh @@ -104,7 +104,14 @@ for i in "${!CMDS[@]}"; do elif [ $pane -eq 3 ]; then tmux split-window -v -t $SESSION:$win.1 fi + fi + + # Always apply appropriate layout based on current pane count + current_panes=($(tmux list-panes -t $SESSION:$win -F '#P')) + if [ ${#current_panes[@]} -eq 2 ]; then tmux select-layout -t $SESSION:$win even-horizontal + else + tmux select-layout -t $SESSION:$win tiled fi # Check if command is already running in the pane