Skip to content

Instantly share code, notes, and snippets.

@apzentral
Created August 10, 2024 19:07
Show Gist options
  • Save apzentral/61490e5c8f5c64117dc6d780f0b1411c to your computer and use it in GitHub Desktop.
Save apzentral/61490e5c8f5c64117dc6d780f0b1411c to your computer and use it in GitHub Desktop.
tmux script to generate multiple windows
#!/bin/bash
SESSION="app"
PROJECT_PATH="~/projects/app"
cd $PROJECT_PATH
tmux new-session -d -s $SESSION
tmux rename-window -t 1 'backend'
tmux new-window -t $SESSION:2 -n 'frontend'
tmux new-window -t $SESSION:3 -n 'backend-src'
tmux new-window -t $SESSION:4 -n 'frontend-src'
tmux send-keys -t 'backend' "cd $PROJECT_PATH/backend" Enter "make dev" Enter
tmux send-keys -t 'frontend' "cd $PROJECT_PATH/frontend" Enter "make dev" Enter
tmux send-keys -t 'backend-src' "cd $PROJECT_PATH/backend" Enter "code app-backend.code-workspace &" Enter
tmux send-keys -t 'frontend-src' "cd $PROJECT_PATH/frontend" Enter "code app-frontend.code-workspace &" Enter
tmux attach-session -t $SESSION:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment