24 lines
564 B
Bash
Executable File
24 lines
564 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
SESSION_NAME="ghostty"
|
|
PATH=/opt/homebrew/bin:$PATH
|
|
TMUX="$(command -v tmux)"
|
|
|
|
if [[ ! -x $TMUX ]]; then
|
|
echo "tmux doesn't appear to be installed. PATH:"
|
|
echo "$PATH"
|
|
exit 0
|
|
fi
|
|
|
|
# Check if the session already exists
|
|
"$TMUX" has-session -t "$SESSION_NAME" 2>/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
# If the session exists, reattach to it
|
|
"$TMUX" attach-session -t "$SESSION_NAME"
|
|
else
|
|
# If the session doesn't exist, start a new one
|
|
"$TMUX" new-session -s "$SESSION_NAME" -d
|
|
"$TMUX" attach-session -t "$SESSION_NAME"
|
|
fi
|