Created
April 14, 2026 12:00
-
-
Save ItzaMi/d8da1e779d05ce40a66ed75ddeae2433 to your computer and use it in GitHub Desktop.
runtime / live-edit for tmux panes - on exiting session, ask for one more pane and it sorts out a reasonable spot for it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" | |
| panes=$(tmux list-panes | wc -l | tr -d ' ') | |
| if [ "$panes" -eq 1 ]; then | |
| tmux split-window -h -l 33% -c "#{pane_current_path}" | |
| else | |
| target=$(tmux list-panes -F '#{pane_id} #{pane_left} #{pane_top}' \ | |
| | sort -k2,2nr -k3,3nr | head -1 | awk '{print $1}') | |
| tmux split-window -v -t "$target" -c "#{pane_current_path}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment