asmvik / asmvik/yabai

`mouse_follows_focus` improvement suggestions

Open
#1,019 10 comments 0 reactions 0 assignees View on GitHub
bug suggestion
Dominant language
C
Stars
29.6k
Forks
758
PR merge metrics
No merged PRs in 30d

Description

Hello folks, still loving Yabai. =D

I've had to re-enable SIP and so I'm learning how to work with that. One of the biggest helps for me is mouse-follows-focus. Without this, using `yabai` to change which external display is focused doesn't work. But if I use mouse-follows-focus along with focus-follows-mouse, it works great.

However, this has caused me to care a lot about mouse-follows-focus. I have one specific issues that causes me ... a lot of difficulty: focusing Finder when my mouse moves over the gap around windows. This is especially true when moving to the menubar. With focus-follows-mouse this isn't *too* bad. But with mouse-follows-focus, the mouse can be snapped to the center of the window when it drifts over the border. This is very surprising, and compounds issues.

I thought of a few improvements that would really help me, and wonder if they would be feasible.

1. Avoid changing focus when the mouse is over the desktop. I guess this is properly about focus-follows-mouse, but thought I'd mention it.
2. Avoid focus change (in any direction) when the mouse is within the padding of the window. The goal would be both to avoid de-focusing the window, but as or more important to not re-focus it and center the mouse within the window.
3. Maybe even more awesome than (2) would be to remember the location of the mouse within a window when it loses focus and rather than snapping to the *center* of the window, snap to previous location of the mouse within the window. This would be amazing for me as it would let me leave my mouse in a predictable place (maybe a button) and it still be there even after switching windows.
- Maybe a combination of (2) and (3) would be even better. When focusing a window due to focus-follows-mouse, don't change the mouse position at all. Only do mouse-follows-focus when the focusing event isn't due to following the mouse. And then do (3). This would let you move the mouse out of a window and back, and it would never snap to a different location. But when switching focus through key bindings or some non-mouse event, can restore the previous mouse location within the window.

What do you think?

Also happy to provide any more details useful.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the existing mouse-follows-focus and focus-follows-mouse behavior described in the issue. Compare the requested desktop, window-padding, and remembered-pointer-location cases, then define a focused scope and acceptance criteria before making changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
desktop, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.