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

Send window to display and follow focus #505

Closed
vloth opened this issue May 4, 2020 · 4 comments
Closed

Send window to display and follow focus #505

vloth opened this issue May 4, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@vloth
Copy link

vloth commented May 4, 2020

To send window to display and follow focus I have this little shortcut:

cmd + ctrl - l  : yabai -m window --display prev; yabai -m display --focus prev
cmd + ctrl - h  : yabai -m window --display next; yabai -m display --focus next

Oddly when the window I'm sending to the next display is the latest in the current display the focus doesn't go to the next display (same for prev).

But when I change it to the following snippet everything works as expected:

cmd + ctrl - l  : yabai -m window --display prev; yabai -m display --focus 1
cmd + ctrl - h  : yabai -m window --display next; yabai -m display --focus 2

Am I correct to assume the first snippet is wrong and I should always query prev/next display indices?

@koekeishiya
Copy link
Owner

The intention is for the first set of commands to work as you initially wanted, but this is a bit tricky because of how macOS window focusing reports across multiple monitors. I would say that this is a bug, but I don't actually know how to solve it at this time.

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

Fixed on master.

@koekeishiya koekeishiya added addressed on master; not released Fixed upstream, but not yet released and removed addressed on master; not released Fixed upstream, but not yet released labels May 9, 2020
@anildigital
Copy link

@koekeishiya I use following. The issue I have is when window from display 2 is moved to display 1 which has multiple windows, it's not focusing on just moved window. I have to hit cmd + tab to focus to the window. Any solution for this behaviour? Thanks

shift + cmd - space : yabai -m window --display prev; yabai -m display --focus prev  || yabai -m window --display next;  yabai -m display --focus next

@rockyzhang24
Copy link

rockyzhang24 commented Apr 15, 2021

This is not an issue. Try the script below:

shift + cmd - space : cur_window=$(yabai -m query --windows --window | jq '.id') && \
                      yabai -m window --display prev  || yabai -m window --display next && \
                      yabai -m window --focus ${cur_window}

That is, before sending the window, we can firstly get the the id of the current window, and then after the window is sent, we can focus the window with that id.

anildigital added a commit to anildigital/dotfiles that referenced this issue Apr 22, 2021
unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
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

4 participants