Skip to content
New issue

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

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

Already on GitHub? # to your account

Yabai focus is slow or non-existent in some scenarios #1958

Closed
alber70g opened this issue Nov 7, 2023 · 4 comments
Closed

Yabai focus is slow or non-existent in some scenarios #1958

alber70g opened this issue Nov 7, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@alber70g
Copy link

alber70g commented Nov 7, 2023

I'm using the following config for focus:

yabai -m config mouse_follows_focus           on           # on, off
yabai -m config focus_follows_mouse           autoraise    # off, autoraise, autofocus

When switching my mouse to another window it should get focus. However, most of the time, when I move the cursor and stop, while hovering over the window, it doesn't focus until I move the cursor only a tiny bit.

I've added a video to demonstrate this

focus-yabai.mov

I'd like it to be instant, or at least focus without having to move sloowwly or re-move to get focus. It used to be better, as I remember.

@koekeishiya
Copy link
Owner

This seems to be caused by some kind of mouse acceleration interference or something. yabai is reacting to mouse_moved events, and looking at event logs, the cursor is actually moving after yabai has received the last mouse_moved event that it can react to.

Closing as not fixable.

@koekeishiya
Copy link
Owner

koekeishiya commented Mar 13, 2024

Nvm.. you are correct. This is caused by the logic implemented to try and reduce the number of events we respond to:

    uint64_t event_time = CGEventGetTimestamp(context);
    float dt = ((float) event_time - g_mouse_state.last_moved_time) * (1.0f / 1E6);
    if (dt < 25.0f) goto out;

I have looked at cpu usage with and without and the difference is very small, so I will remove this in favor of increased responsiveness.

@koekeishiya koekeishiya reopened this Mar 13, 2024
@koekeishiya koekeishiya added the bug Something isn't working label Mar 13, 2024
@koekeishiya
Copy link
Owner

Fixed on master.

@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label Mar 13, 2024
@koekeishiya
Copy link
Owner

Fixed in v7.0.0.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants