From d2b56055fe276f3af62e9e12a5c3f980bd9387cd Mon Sep 17 00:00:00 2001 From: prmoustache Date: Mon, 30 Dec 2024 14:51:39 +0100 Subject: [PATCH] tmux-ai-prompts --- bash_functions/tmux-ai-prompts.sh | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bash_functions/tmux-ai-prompts.sh diff --git a/bash_functions/tmux-ai-prompts.sh b/bash_functions/tmux-ai-prompts.sh new file mode 100644 index 0000000..8f0a944 --- /dev/null +++ b/bash_functions/tmux-ai-prompts.sh @@ -0,0 +1,36 @@ +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 and run commands + 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" + + tmux select-layout tiled >/dev/null + tmux set-window-option synchronize-panes on >/dev/null + + # Attach to the session (optional - comment out if you don't want to attach automatically) + tmux select-pane -t 0 + tmux attach-session -t "$session_name" + +}