From b7d7360c4160a30e1f11cbb0aae2be866f4bb9ac Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 10 Feb 2026 15:24:54 -0600 Subject: feat(aix): sort windows on every attach, add --attach flag Sort windows (shells at 0, projects alphabetically from 1) on every session access including --attach. Move --attach check after function definitions so sort_windows is available. --- dotfiles/common/.local/bin/aix | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'dotfiles/common') diff --git a/dotfiles/common/.local/bin/aix b/dotfiles/common/.local/bin/aix index a421139..ecbb24c 100755 --- a/dotfiles/common/.local/bin/aix +++ b/dotfiles/common/.local/bin/aix @@ -12,16 +12,6 @@ attach_session() { fi } -# Attach directly to existing session -if [ "$1" = "--attach" ]; then - if ! tmux has-session -t "$SESSION" 2>/dev/null; then - echo "No $SESSION session to attach to." >&2 - exit 1 - fi - attach_session - exit 0 -fi - # Dependency checks for cmd in fzf tmux claude; do if ! command -v "$cmd" &>/dev/null; then @@ -100,6 +90,17 @@ sort_windows() { fi } +# Attach directly to existing session +if [ "$1" = "--attach" ]; then + if ! tmux has-session -t "$SESSION" 2>/dev/null; then + echo "No $SESSION session to attach to." >&2 + exit 1 + fi + sort_windows + attach_session + exit 0 +fi + # If session exists, add new windows to it if tmux has-session -t "$SESSION" 2>/dev/null; then # Get existing window names to filter duplicates @@ -132,11 +133,11 @@ if tmux has-session -t "$SESSION" 2>/dev/null; then [ -z "$first_wid" ] && first_wid="$wid" done - sort_windows tmux select-window -t "$first_wid" fi fi + sort_windows attach_session exit 0 fi -- cgit v1.2.3