diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-10 15:24:54 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-10 15:24:54 -0600 |
| commit | b7d7360c4160a30e1f11cbb0aae2be866f4bb9ac (patch) | |
| tree | dcc13bc8a9709ac5e86f78c02c5cb3c37f6a9aeb /dotfiles/common | |
| parent | e076788e23fb9070738b5a85beb54bd9eef70f8e (diff) | |
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.
Diffstat (limited to 'dotfiles/common')
| -rwxr-xr-x | dotfiles/common/.local/bin/aix | 23 |
1 files changed, 12 insertions, 11 deletions
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 |
