-
|
If I have two floating windows close to each other, can I somehow easily jump from one to the other, preferably using "directional commands" rather than cycling through all floating windows, similarly to how I would Edit: typo |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
The directional commands only apply to managed windows. You'd have to script something yourself using the query system. I believe something like this has been done previously in one of the closed issues, but I don't remember what to search for to locate it. docs for query: https://github.com/koekeishiya/yabai/blob/master/doc/yabai.asciidoc#query |
Beta Was this translation helpful? Give feedback.
-
|
A variant of this might work #1326 |
Beta Was this translation helpful? Give feedback.
-
|
Here's take 1, that does not jump directionally, but rather cycles windows that are floating, if the script is run from a floating window. If it is run from a tiled window it will jump between tiled windows. is_float=$(yabai -m query --windows --window | jq '."is-floating"')
if [ "$is_float" = "true" ]; then
yabai -m window --focus $(yabai -m query --windows | \
jq -e --argjson pos 1 '(.[] | select(."has-focus")) as {$id, $app}
| map(select(."is-floating" == true))
| sort_by(.space, .frame.x, .frame.y)
| map(.id)
| .[(index($id)+($pos))%length]')
else
yabai -m window --focus east || yabai -m display --focus east
fiEdit: Change 1 to -1 to move in the other direction. I put this in a script and bind it like this alt - h : ~/bin/yabai-left.sh
alt - l : ~/bin/yabai-right.sh |
Beta Was this translation helpful? Give feedback.
-
|
I particularly wanted a directional window navigation that would ignore any windows hiding behind other windows. It took a while, but after spending enough time on jq, I finally got it working. I'm sharing it here in case it would help anyone. The above script will output the id of the window in the current space that has a part of it visible on the screen that is in the direction of the $dir variable. |
Beta Was this translation helpful? Give feedback.
The directional commands only apply to managed windows. You'd have to script something yourself using the query system. I believe something like this has been done previously in one of the closed issues, but I don't remember what to search for to locate it.
docs for query: https://github.com/koekeishiya/yabai/blob/master/doc/yabai.asciidoc#query