dotfiles/.local/bin/tmux-session-switcher
Sergio Laín 335db8d4bd
refactor(tmux): session-switcher is now dynamic
Can pass a session name
2025-08-27 14:10:57 +02:00

17 lines
383 B
Bash
Executable file

#!/bin/bash
SESSION_NAME=$1
if [ -z "$SESSION_NAME" ]; then
tmux switch-client -l &>/dev/null
fi
if [ "$(tmux display-message -p '#S')" == "$SESSION_NAME" ]; then
tmux switch-client -l &>/dev/null
else
if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
tmux switch-client -t "$SESSION_NAME" &>/dev/null
else
tmuxp load -y "$SESSION_NAME" &>/dev/null
fi
fi