aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/workspace
blob: bfc235771c5f30a37e94a25b15bd609f89869a45 (plain)
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
#!/bin/sh

# Yaroslav de la Peña Smirnov 2021
# 
# A quick script to quickly open several terminal windows, in a layout that I
# often use, all in the specified directory. The layout looks something like
# this:
# 
# ┌──────────────────┬──────────────────────────────────────────────┐
# │                  │                                              │
# │                  │                                              │
# │        lf        │                                              │
# │                  │                                              │
# │                  │                                              │
# ├──────────────────┤                                              │
# │                  │                    shell                     │
# │                  │                                              │
# │                  │                                              │
# │       shell      │                                              │
# │                  │                                              │
# │                  │                                              │
# │                  │                                              │
# └──────────────────┴──────────────────────────────────────────────┘

if [ -z "$1" ]; then
	echo "Specify working directory"
	exit 1
fi

swaymsg "gaps inner current set 0; gaps outer current set 0"

cd "$1"
setsid $TERMINAL -a "$TERMINAL lf:$1" "lf" >/dev/null 2>&1 & sleep 0.1
setsid $TERMINAL -a "$TERMINAL edit:$1" >/dev/null 2>&1 & sleep 0.1

sleep 0.2
swaymsg "[app_id=\"$TERMINAL lf:$1\"] focus; resize set width 27ppt; split v"
setsid $TERMINAL >/dev/null 2>&1 & sleep 0.2
swaymsg "resize set height 60ppt" && sleep 0.1
swaymsg "[app_id=\"$TERMINAL edit:$1\"] focus"