probo/frontend/tmux.bash
2022-09-23 10:24:03 +02:00

26 lines
786 B
Bash
Executable file

#!/bin/bash
# Set Session Name
SESSION="kratos-svelte-login"
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 'src'
# 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 'src' 'cd src && npm run dev' C-m
# Create an horizontal pane for terminal commands
tmux split-window -vf -l 1
tmux send-keys 'emacs src/routes/+page.svelte &' Enter
fi
# Attach Session, on the Main window
tmux attach-session -t $SESSION:0