diff options
Diffstat (limited to 'dotfiles')
| -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 |
