mirror of
https://github.com/theniceboy/.config.git
synced 2025-12-26 22:54:59 +08:00
15 lines
375 B
Bash
Executable file
15 lines
375 B
Bash
Executable file
#!/bin/bash
|
|
|
|
index="$1"
|
|
|
|
if [[ -z "$index" || ! "$index" =~ ^[0-9]+$ ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
# Get session matching index prefix (e.g., "1-" for index 1)
|
|
target=$(tmux list-sessions -F '#{session_id} #{session_name}' 2>/dev/null | awk -v idx="$index" '$2 ~ "^"idx"-" {print $1; exit}')
|
|
|
|
if [[ -n "$target" ]]; then
|
|
tmux switch-client -t "$target"
|
|
tmux refresh-client -S
|
|
fi
|