blob: 52222983663d9e85589d82812f2779f48bd7fbc0 (
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
|
#!/bin/sh
# bspcDirectionFocus.sh: Directionally select node with same floating state
#
# Usage: bspcDirectionFocus.sh DIRECTION
usageMessage="Usage: bspcDirectionFocus.sh DIRECTION"
direction="$1"
if ! echo "$direction" | grep -Eq '(west)|(south)|(north)|(east)'; then
echo "$usageMessage" 1>&2
exit 1
fi
status="$(bspc wm --get-status)"
# If floating (TF) select floating in direction.
# Else if monocle (LM) and west or east select previous or next local window in direction.
# Else select non-floating in direction.
if echo "$status" | grep -q ':TF:'; then
bspc node --focus "$direction".floating;
elif echo "$status" | grep -q ':LM:'; then
if [ "$direction" = "west" ]; then
bspc node --focus prev.local.window.!floating
elif [ "$direction" = "east" ]; then
bspc node --focus next.local.window.!floating
fi
else
bspc node --focus "$direction".!floating
fi
|