36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
function tmux-ai-prompts() {
|
|
local session_name="$1"
|
|
|
|
# Check if a session name is provided
|
|
if [[ -z "$session_name" ]]; then
|
|
echo "Error: Session name is required. Usage: start_tmux_session
|
|
ession_name>"
|
|
return 1
|
|
fi
|
|
|
|
# Check if a tmux session with the given name already exists
|
|
if tmux has-session -t "$session_name"; then
|
|
echo "Error: A tmux session with the name '$session_name' already
|
|
ists."
|
|
return 1
|
|
fi
|
|
|
|
# Start the tmux session and create initial pane
|
|
tmux new-session -s "$session_name" -d "gemini"
|
|
tmux set-window-option -g automatic-rename off >/dev/null
|
|
tmux select-pane -T "gemini"
|
|
|
|
# Split window horizontally, run commands and set titles
|
|
tmux split-window -v -t "$session_name:0" \; send-keys "gpt" C-m
|
|
tmux select-pane -T "gpt"
|
|
tmux split-window -v -t "$session_name:0" \; send-keys "gpt --model claude-3.5-sonnet" C-m
|
|
tmux select-pane -T "claude"
|
|
|
|
# set layout, activate synchronization and select original pane
|
|
tmux select-layout tiled >/dev/null
|
|
tmux set-window-option synchronize-panes on >/dev/null
|
|
tmux select-pane -t 0
|
|
|
|
# Attach to the session tmux attach-session -t "$session_name"
|
|
}
|