blob: 4f72c89b0122dcf06d985a5146a4bcd4ddc59786 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/usr/bin/env bash
# MangoWM exposes the active monitor and tag layout through its IPC client.
if [[ -n "${MANGO_INSTANCE_SIGNATURE:-}" ]] && command -v mmsg >/dev/null 2>&1; then
mmsg get all-monitors 2>/dev/null | python3 -c '
import json
import sys
try:
data = json.load(sys.stdin)
monitor = next((m for m in data.get("monitors", []) if m.get("active")), None)
layout = (monitor or {}).get("layout", "")
symbol = (monitor or {}).get("layout_symbol", "")
except (json.JSONDecodeError, StopIteration):
sys.exit(0)
symbols = {
"T": "[]=",
"DW": "[D]",
"S": "|||",
"M": "[M]",
}
value = symbols.get(symbol, symbols.get(layout, symbol or layout))
if value:
print(value)
'
exit 0
fi
# Keep the Hyprland fallback so the same script remains useful there.
layout=$(hyprctl activeworkspace -j 2>/dev/null \
| sed -n 's/.*"tiledLayout"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
case "$layout" in
master)
printf '[]=\n'
;;
dwindle)
printf '[D]\n'
;;
scrolling)
printf '|||\n'
;;
monocle)
printf '[M]\n'
;;
"")
exit 0
;;
*)
printf '%s\n' "$layout"
;;
esac
|