mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Allow for a second AI
This commit is contained in:
+15
-7
@@ -1,12 +1,13 @@
|
||||
# Create a Tmux Dev Layout with editor, ai, and terminal
|
||||
# Usage: tdl <c|cx|codex|other_ai>
|
||||
# Usage: tdl <c|cx|codex|other_ai> [<second_ai>]
|
||||
tdl() {
|
||||
[[ -z $1 ]] && { echo "Usage: tdl <c|cx|codex|other_ai>"; return 1; }
|
||||
[[ -z $1 ]] && { echo "Usage: tdl <c|cx|codex|other_ai> [<second_ai>]"; return 1; }
|
||||
[[ -z $TMUX ]] && { echo "You must start tmux to use tdl."; return 1; }
|
||||
|
||||
local current_dir="${PWD}"
|
||||
local editor_pane ai_pane
|
||||
local editor_pane ai_pane ai2_pane
|
||||
local ai="$1"
|
||||
local ai2="$2"
|
||||
|
||||
# Use TMUX_PANE for the pane we're running in (stable even if active window changes)
|
||||
editor_pane="$TMUX_PANE"
|
||||
@@ -20,6 +21,12 @@ tdl() {
|
||||
# Split editor pane horizontally - AI on right 30% (capture new pane ID directly)
|
||||
ai_pane=$(tmux split-window -h -p 30 -t "$editor_pane" -c "$current_dir" -P -F '#{pane_id}')
|
||||
|
||||
# If second AI provided, split the AI pane vertically
|
||||
if [[ -n $ai2 ]]; then
|
||||
ai2_pane=$(tmux split-window -v -t "$ai_pane" -c "$current_dir" -P -F '#{pane_id}')
|
||||
tmux send-keys -t "$ai2_pane" "$ai2" C-m
|
||||
fi
|
||||
|
||||
# Run ai in the right pane
|
||||
tmux send-keys -t "$ai_pane" "$ai" C-m
|
||||
|
||||
@@ -31,12 +38,13 @@ tdl() {
|
||||
}
|
||||
|
||||
# Create multiple tdl windows with one per subdirectory in the current directory
|
||||
# Usage: tdlm <c|cx|codex|other_ai>
|
||||
# Usage: tdlm <c|cx|codex|other_ai> [<second_ai>]
|
||||
tdlm() {
|
||||
[[ -z $1 ]] && { echo "Usage: tdlm <c|cx|codex|other_ai>"; return 1; }
|
||||
[[ -z $1 ]] && { echo "Usage: tdlm <c|cx|codex|other_ai> [<second_ai>]"; return 1; }
|
||||
[[ -z $TMUX ]] && { echo "You must start tmux to use tdlm."; return 1; }
|
||||
|
||||
local ai="$1"
|
||||
local ai2="$2"
|
||||
local base_dir="$PWD"
|
||||
local first=true
|
||||
|
||||
@@ -49,11 +57,11 @@ tdlm() {
|
||||
|
||||
if $first; then
|
||||
# Reuse the current window for the first project
|
||||
tmux send-keys -t "$TMUX_PANE" "cd '$dirpath' && tdl $ai" C-m
|
||||
tmux send-keys -t "$TMUX_PANE" "cd '$dirpath' && tdl $ai $ai2" C-m
|
||||
first=false
|
||||
else
|
||||
local pane_id=$(tmux new-window -c "$dirpath" -P -F '#{pane_id}')
|
||||
tmux send-keys -t "$pane_id" "tdl $ai" C-m
|
||||
tmux send-keys -t "$pane_id" "tdl $ai $ai2" C-m
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user