Fix bspc/focus skipping over windows

Lets say you have two screens. A, B, C and D are your windows:

  [AB][CD]

If you have C focused and invoked bspc/focus --west, it would focus A,
instead of B.
This commit is contained in:
Henrik Lissner 2019-12-03 23:45:57 -05:00
parent bb81acfb00
commit eec332814a
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -18,8 +18,13 @@ if [[ $1 == -m ]]; then
leap=1; shift leap=1; shift
fi fi
dir=$1 dir=$1
opposite=
case $dir in west|south|north|east) ;; case $dir in
west) opposite=east ;;
east) opposite=west ;;
north) opposite=north ;;
south) opposite=south ;;
*) >&2 echo "Not a valid direction: $dir" *) >&2 echo "Not a valid direction: $dir"
exit 1 exit 1
esac esac
@ -32,6 +37,8 @@ else
if ! bspc node -f "$dir.local"; then if ! bspc node -f "$dir.local"; then
if [[ $(bspc query -M -m "$dir") ]]; then if [[ $(bspc query -M -m "$dir") ]]; then
bspc monitor -f "$dir" bspc monitor -f "$dir"
# Ensure we start at the edge of the window we arrived from
while bspc node -f "$opposite.local"; do :; done
fi fi
fi fi
fi fi