#!/bin/bash # Set Session Name SESSION="yt-dls" SESSIONEXISTS=$(tmux list-sessions | grep $SESSION) # Only create tmux session if it doesn't already exist if [ "$SESSIONEXISTS" = "" ] then # Start New Session with our name tmux new-session -d -s $SESSION # Name first Pane and start zsh tmux rename-window -t 0 'Main' # Create and setup pane for running the backend # tmux send-keys -t 'Main' 'bash' C-m 'clear' C-m 'cd backend && go build -o backend . && ./backend' C-m tmux send-keys -t 'Main' 'cd backend && go build -o backend . && ./backend' C-m # Create and setup pane for running the backend tmux split-window -h 'cd frontend && npm run dev' # Create an horizontal pane for terminal commands tmux split-window -vf -l 1 tmux send-keys 'emacs backend/main.go &' Enter fi # Attach Session, on the Main window tmux attach-session -t $SESSION:0