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 | 9e27803d3bbdd3b67c5ca36c11471a04fa505853 (patch) | |
| tree | 6b97f6568861c905d31f7987b6e1f2dc5cefb1e7 /dotfiles/common | |
| parent | df237c9d13fd3c1f04faf390e2b82e8739d0f4d8 (diff) | |
| download | archsetup-9e27803d3bbdd3b67c5ca36c11471a04fa505853.tar.gz archsetup-9e27803d3bbdd3b67c5ca36c11471a04fa505853.zip | |
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 |
