-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinit_tmux
executable file
·69 lines (53 loc) · 2.79 KB
/
init_tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
SESSION1='rtvision-app'
SESSION2='php'
BASE_REPO_DIR=~/monorepo
OPEN_SOURCE_DIR=~/open-source
PHP_HOME=~/apache-php-apps
# set up tmux
tmux start-server
# create a new tmux sessiona and -x and -y come from https://unix.stackexchange.com/questions/569729/tmux-not-splitting-panes-with-desired-percentage-size
tmux new-session -d -s $SESSION1 -c $BASE_REPO_DIR/ -n 'ui' -x "$(tput cols)" -y "$(tput lines)"
tmux split-window -h -l 75% -c $BASE_REPO_DIR
tmux select-pane -t ui.left
tmux split-window -v -l 40% -c $BASE_REPO_DIR
tmux select-pane -t ui.right
tmux new-window -t $SESSION1:2 -n 'docker' -c $BASE_REPO_DIR
tmux new-window -t $SESSION1:3 -n 'api' -c $BASE_REPO_DIR/apps/app-api
tmux new-window -t $SESSION1:4 -n 'packages' -c $BASE_REPO_DIR/packages
tmux new-window -t $SESSION1:5 -n 'add-in' -c $BASE_REPO_DIR/apps/add-in-word-excel
tmux split-window -h -l 75% -t add-in -c $BASE_REPO_DIR/apps/add-in-word-excel
tmux select-pane -t add-in.right
tmux new-window -t $SESSION1:6 -n 'store' -c $BASE_REPO_DIR/apps/app-store
tmux new-window -t $SESSION1:7 -n 'aws-terraform' -c $BASE_REPO_DIR
tmux new-window -t $SESSION1:8 -n 'db' -c $BASE_REPO_DIR
tmux new-window -t $SESSION1:9 -n 'open-source' -c $OPEN_SOURCE_DIR
tmux split-window -h -l 70% -t open-source -c $OPEN_SOURCE_DIR
tmux split-window -v -l 5% -t open-source.left -c $OPEN_SOURCE_DIR
tmux select-pane -t open-source.right
# Need to sleep to make sure shells are active
sleep 1
tmux send-keys -t ui.top-left 'sleep 30' Enter 'pnpm dev --filter=@rtvision/app-ui' Enter
tmux send-keys -t ui.bottom-left 'pnpm dev --filter=@rtvision/app-ui^...' Enter
tmux send-keys -t docker 'make' Enter
tmux send-keys -t add-in.left 'pnpm start' Enter
tmux send-keys -t aws-terraform 'ssh -A ssh' Enter 'cd aws-terraform' Enter
tmux send-keys -t db 'sleep 10' Enter 'psql -U postgres -h localhost rtvision' Enter
tmux send-keys -t open-source.bottom-left 'ssh -L 3333:github.com:22 ssh -N' # Do not hit enter for this just want it there when I need to push/pull to/from github
# go to 3rd window so it is marked as the previous window and accessed via the back key
tmux select-window -t $SESSION1:api
tmux select-window -t $SESSION1:ui
# start other sessions
tmux new-session -d -s $SESSION2 -n 'php-apps' -x "$(tput cols)" -y "$(tput lines)" -c $PHP_HOME/apps
tmux split-window -h -l 75% -t php-apps -c $PHP_HOME/apps
tmux split-window -v -l 30% -t php-apps.left -c $PHP_HOME/apps
tmux select-pane -t php-apps.right
tmux new-window -t $SESSION2:2 -n 'docker' -c $PHP_HOME
tmux new-window -t $SESSION2:3 -n 'db' -c $PHP_HOME
tmux new-window -t $SESSION2:4 -n 'customer' -c
tmux send-keys -t customer 'ssh -A ssh'
sleep 1
tmux send-keys -t docker 'make'
tmux send-keys -t 'psql -U postgres -h localhost -p 5433'
tmux select-window -t $SESSION2:php-apps
tmux attach-session -t $SESSION1