Hacker News new | ask | show | jobs
by TachyonicBytes 747 days ago
I wonder if following the mouse for focus would be doable without disabling SIP. It's one of the features I didn't even see in other macOS WM.
5 comments

It is, Yabai can do it. I am currently using autoraise. Both work great, barring UI weirdness of macOS.

Example. Mousing over another window on the way to the menubar.

https://github.com/sbmpost/AutoRaise

The problem with focus-follows-mouse on macOS is the top menu bar.

If you had it, and tried to mouse to the menu, the menu would switch out from under you.

I have some notes in a file somewhere about how a Mac-native focus-follows-mouse could even work, because I want it. It would end up being a rather different implementation than the X Windows style.

I have an Alfred workflow to search the menu, so not being able to move the mouse there isn’t a big issue.
I've been searching for a sloppy-mouse-focus implementation for OSX for _years_. Pretty sure there's something fundamentally incompatible in how app windows are managed.
Not seeing a way to get the window currently under the mouse pointer, but this is pretty interesting - thanks!
You can get the positions of every windows, the position of the mouse pointer, and you can focus windows.
This is really cool, I'm gonna try and implement it!
It's also a bummer because Terminal.app has the functionality out of the box: https://macos-defaults.com/mouse/focusfollowsmouse.html
It can be implemented within apps, but not across apps afaict.
Should be possible using AX APIs on mac, might not be all that performant, however.
Yup there's AutoFocus which I use daily with Aerospace

https://github.com/synappser/AutoFocus