-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathcreate_tmux_session.sh
31 lines (26 loc) · 999 Bytes
/
create_tmux_session.sh
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
#!/bin/bash
# Name of the new tmux session
SESSION_NAME="amd"
# Array of commands to run in different panels
commands=(
"~/Downloads/clash-linux-amd64-v3 -f ~/.config/clash/flyingbird.pro.yaml"
"~/Data1/github.com/ra-multiplex/target/release/ra-multiplex server"
"cd ~/src/github.com/Dreamacro/clash-dashboard && pnpm start"
"~/Data1/github.com/alacritty/target/release/alacritty"
)
# Create a new tmux session
tmux new-session -d -s $SESSION_NAME
# Create new windows/panels and run the commands
for i in "${!commands[@]}"; do
if [ $i -eq 0 ]; then
# Run the first command in the first (default) pane
tmux send-keys -t $SESSION_NAME "${commands[$i]}" C-m
else
# Create a new pane and run the subsequent commands
tmux split-window -t $SESSION_NAME
tmux send-keys -t $SESSION_NAME "${commands[$i]}" C-m
tmux select-layout -t $SESSION_NAME tiled
fi
done
# Attach to the tmux session
tmux attach-session -t $SESSION_NAME