-
Notifications
You must be signed in to change notification settings - Fork 5
/
tmuxlauncher.sh
executable file
·67 lines (59 loc) · 1.68 KB
/
tmuxlauncher.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
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
#!/bin/bash
# while getopts s: option; do
# case $option in
# s) # Enter a store_id
# app=$OPTARG ;;
# \?) # Invalid option
# echo "Error: Invalid option"
# exit
# ;;
# esac
# done
session="proxysession"
sudo systemctl stop waydroid-container.service
sudo systemctl start waydroid-container.service
if [[ -n $(pgrep tmux) ]]; then
tmuxrunning=true
else
tmuxrunning=false
fi
if [ "$tmuxrunning" = true ]; then
echo "tmux already up = $tmuxrunning"
# Check if the session exists, discarding output
# We can check $? for the exit status (zero for success, non-zero for failure)
# kill session, temp
if tmux has-session -t $session 2>/dev/null; then
echo "Found running tmux $session"
dolaunchsess=false
else
dolaunchsess=true
echo "tmux up but can't find $session"
fi
else
echo "tmux not open, launch new"
dolaunchsess=true
fi
if [ "$dolaunchsess" = true ]; then
echo "Launching new session"
# Set up your session
tmux new-session -d -s $session
# Initial: Top Left
tmux send-keys -t $session "waydroid session start" Enter
# Top Right
tmux split-window -h -t $session
tmux send-keys -t $session "source ~/mobile-network-traffic/mitm-env/bin/activate" Enter
tmux send-keys -t $session "./proxysetup.sh -w" Enter
#tmux split-window -v -p 50 -t $session
# Bottom Right
#tmux send-keys -t $session "hiii" Enter
# Bottom Left
tmux select-pane -t $session:0.0
tmux split-window -v -p 50 -t $session
tmux send-keys -t $session "waydroid show-full-ui" Enter
#tmux select-pane -t $session:0.0
else
echo "Attach existing new session"
fi
tmux att -t $session
# Attach to created session
#tmux attach-session -t $session