From 56f40d8f191df93ce04c408bd8a2dae84d4cef5d Mon Sep 17 00:00:00 2001 From: "Arjun G. Menon" Date: Tue, 30 Jul 2024 01:42:06 -0400 Subject: [PATCH] Add dev_tmux_session.sh --- dev_tmux_session.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 dev_tmux_session.sh diff --git a/dev_tmux_session.sh b/dev_tmux_session.sh new file mode 100755 index 0000000..cd51445 --- /dev/null +++ b/dev_tmux_session.sh @@ -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 +