Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Window focus wraps around, moving west from leftmost window on 90° rotated display #1511

Closed
torgeir opened this issue Nov 1, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@torgeir
Copy link

torgeir commented Nov 1, 2022

With a dual screen setup like this

+----------++-------+
| a        || b     |
|          ||       |
+----------+|       |
            |       |
            |       |
            +-------+

The following command, executed from the rightmost window in a, exits with code 1

❯ yabai -m window --focus east
could not locate a eastward managed window.
❯ echo $?
1

..making it a great candidate for chaining, e.g. like this yabai -m window --focus east || yabai -m display --focus east to move focus to display b

However, the opposite, ran from the leftmost window on the 90° rotated display b exits with code 0

❯ yabai -m window --focus west
❯ echo $?
0

..and instead "wraps" the focus to the last window on display b.

Edit:

This is on yabai-v5.0.1

@torgeir torgeir changed the title Window focus wraps around, moving west from leftmost window on 90° rotated display bug: Window focus wraps around, moving west from leftmost window on 90° rotated display Nov 15, 2022
@torgeir
Copy link
Author

torgeir commented Mar 2, 2023

I am not experiencing this any longer with yabai-v5.0.2.

Edit: That is using the following skhdrc keymaps which again work as expected

alt - h: yabai -m window --focus west || yabai -m display --focus west
alt - l: yabai -m window --focus east || yabai -m display --focus east

@torgeir torgeir closed this as completed Mar 2, 2023
@torgeir torgeir reopened this May 8, 2023
@torgeir
Copy link
Author

torgeir commented May 8, 2023

Either this has returned or I misunderstood the details of what was failing the last time around, cause you will not experience the following if you only have one window on each of the displays.

Here's some more details:

With displays a and b, b rotated 90°, and windows w and w' in a vertical split;
Starting with the selected window w', using the key binding alt-h moves w' to w to a, like I would expect.

a            b
+----------++-------+
|          || w | w'|
|          ||   |   |
+----------+|   |   |
            |   |   |
            |   |   |
            +-------+

With displays a and b, b rotated 90°, and windows w and w' in a horizontal split;
Starting with the selected window w', using the key binding alt-h moves w' to w and continues cycling w' and w, never reaching display a, this was unexpected to me.

a            b
+----------++-------+
|          || w     |
|          ||       |
+----------+|-------|
            | w'    |
            |       |
            +-------+

I would expect the movement to go directly from w' to display a

This is yabai-v5.0.4

@slam
Copy link

slam commented May 18, 2023

I experienced a similar issue, and I hope my workaround can help you as well.

Upon briefly examining the code, I suspected that the slight overlapping of windows was triggering a bug related to window focus management. By introducing a small gap between the windows, my specific issue was resolved.

I set my window gap to 5:

yabai -m config window_gap 5

koekeishiya added a commit that referenced this issue May 21, 2023
@koekeishiya
Copy link
Owner

I was unable to reproduce this specific issue, but I have fixed an off-by-one issue on master that caused a similar issue: #1463 (comment)

@koekeishiya koekeishiya added the bug Something isn't working label May 21, 2023
@koekeishiya
Copy link
Owner

Probably fixed in v5.0.5. Feel free to reopen if you can reproduce the issue in the new version.

@torgeir
Copy link
Author

torgeir commented May 22, 2023

Works like a charm, thanks!

shinyquagsire23 pushed a commit to shinyquagsire23/yabai that referenced this issue Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants