Skip to content

Commit

Permalink
Add dev_tmux_session.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
arjun-menon committed Jul 30, 2024
1 parent e36d148 commit 56f40d8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions dev_tmux_session.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

SESSION_NAME="alteza_work_session"

mkdir -p test_output/

# Check if the session already exists
if tmux has-session -t $SESSION_NAME 2>/dev/null; then
echo "Session $SESSION_NAME already exists. Attaching to it."
tmux attach-session -t $SESSION_NAME
else
# Create a new session and name it
tmux new-session -d -s $SESSION_NAME

# Split the window horizontally
tmux split-window -v -l 20%

# Send a command to the first pane
tmux send-keys -t 0 'cd test_output; python3 -m http.server 1234' C-m

# Send a command to the second pane
tmux send-keys -t 1 'source venv/bin/activate.fish' C-m

tmux swap-pane -s 0 -t 1

# Attach to the created session
tmux attach-session -t $SESSION_NAME
fi

0 comments on commit 56f40d8

Please sign in to comment.