-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplitwindow.bash
More file actions
executable file
·52 lines (45 loc) · 1.39 KB
/
splitwindow.bash
File metadata and controls
executable file
·52 lines (45 loc) · 1.39 KB
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
#!/bin/bash
#########################################################################
# Name: youareidiot.bash
#
# You are idiot animation
#
# Usage: ./youareidiot.bash
#
# Author: Ryosuke Tomita
# Date: 2021/03/09
##########################################################################
PKG="uareidiot"
function clonetmux()
{
for ((n=0; n < $cnt; n++));
do
[ "$h_or_v" = "-v" ] && h_or_v="-h" || h_or_v="-v" #split tmux windows direction is horizontal and vertical.
if [ $cnt -eq 1 ]; then
./uareidiot.bash
else
panes=$(tmux list-panes -t $PKG 2>/dev/null)
splits=$(echo "$panes" | wc -l)
pane=$((RANDOM % $splits))
tmux split-window $h_or_v -t "${PKG}.$pane" ./uareidiot.bash
sleep 0.5
fi
done
}
#--------------------main--------------------
declare -i cnt=${1:-1} #tmux window number
echo $cnt > record
# tmux
arrangements="main-horizontal main-vertical tiled"
if [ -z "$TMUX" ]; then
tmux_launcher=tmux
$tmux_launcher new-session -d -s $PKG "/bin/bash"
$tmux_launcher send-keys -t $PKG "$0 $1"
$tmux_launcher send-keys -t $PKG Enter
exec $tmux_launcher attach-session -t $PKG
exit 1
fi
tmux new-window -n $PKG "$WIDGET_DIR/$widget1" \; \
set-option -g pane-active-border-bg "default" \; \
set-option -g pane-active-border-fg "default" >/dev/null 2>&1
clonetmux