commit 5d4de45
hovercats
·
2023-12-04 19:56:19 +0000 UTC
parent cedfca0
tile: nits
1 files changed,
+20,
-20
M
sh/tile
M
sh/tile
+20,
-20
1@@ -4,38 +4,38 @@
2 # arrange windows in a tiled pattern
3
4 # default values for gaps and master area
5-PANEL=${PANEL:-0}
6-GAP=${GAP:-20}
7-MASTER=${MASTER:-1000}
8+PANEL="${PANEL:-0}"
9+GAP="${GAP:-20}"
10+MASTER="${MASTER:-1000}"
11
12 # get current window id and its borderwidth
13-PFW=$(pfw)
14-BW=$(wattr b "$PFW")
15+PFW="$(pfw)"
16+BW="$(wattr b "${PFW}")"
17
18 # get root window's size (beware, multi-head setups...)
19-ROOT=$(lsw -r)
20-SW=$(wattr w "$ROOT")
21-SH=$(wattr h "$ROOT")
22+ROOT="$(lsw -r)"
23+SW="$(wattr w "${ROOT}")"
24+SH="$(wattr h "${ROOT}")"
25
26 # get the number of windows to put in the stacking area
27-# using grep -c here does no give us the correct behavior.
28+# using grep -c here does not give us the correct behavior.
29 # shellcheck disable=2126
30-MAX=$(lsw|grep -v "$PFW"|wc -l)
31+MAX="$(lsw | grep -v "${PFW}" | wc -l)"
32
33 # calculate usable screen size (without borders and gaps)
34-SW=$((SW - GAP - 2*BW))
35-SH=$((SH - GAP - PANEL))
36+SW="$((SW - GAP - 2*BW))"
37+SH="$((SH - GAP - PANEL))"
38
39-Y=$((0 + GAP + PANEL))
40+Y="$((0 + GAP + PANEL))"
41 # put current window in master area
42-wtp "$GAP" $Y $((MASTER - GAP - 2*BW)) $((SH - GAP - 2*BW)) "$PFW"
43+wtp "${GAP}" "$Y" "$((MASTER - GAP - 2*BW))" "$((SH - GAP - 2*BW))" "${PFW}"
44
45 # and now, stack up all remaining windows on the right
46-X=$((MASTER + GAP))
47-W=$((SW - MASTER - GAP))
48-H=$((SH / MAX - GAP - 2*BW))
49+X="$((MASTER + GAP))"
50+W="$((SW - MASTER - GAP))"
51+H="$((SH / MAX - GAP - 2*BW))"
52
53-for wid in $(lsw|grep -v "$PFW"); do
54- wtp $X $Y $W $H "$wid"
55- Y=$((Y + H + GAP + 2*BW))
56+for wid in $(lsw | grep -v "${PFW}"); do
57+ wtp "$X" "$Y" "$W" "$H" "${wid}"
58+ Y="$((Y + H + GAP + 2*BW))"
59 done