19

PROBLEM: how to implement focus follow mouse for all windows / apps on MacOS?

CONTEXT: terminal commands such as "defaults write com.apple.terminal FocusFollowsMouse -string true" implement the desired behavior ONLY for terminal windows.

SIMILAR POST: Implement "Mouse Follows Focus" on MacOS

Rambatino
  • 4,716
  • 1
  • 33
  • 56
DiF
  • 503
  • 1
  • 5
  • 10

4 Answers4

22

This is the answer: https://github.com/sbmpost/AutoRaise Works perfectly.

For the precise, classic behaviour of "focus follows mouse", without raising the window, it must be compiled with the suggested flags

make CXXFLAGS="-DOLD_ACTIVATION_METHOD -DEXPERIMENTAL_FOCUS_FIRST" && make install

and then run with the options:

/Applications/AutoRaise.app/Contents/MacOS/AutoRaise delay=0 focusDelay=1
Tilo
  • 33,354
  • 5
  • 79
  • 106
DiF
  • 503
  • 1
  • 5
  • 10
  • What do "the window" and "it" refer to in the sentence 'For the precise, classic behaviour of "focus follows mouse", without raising the window, it must be compiled with the suggested flags'? The only 'make' command I'm familiar with is for automating build processes in software development. I have no idea what this answer is talking about. – Addlai Nov 20 '22 at 21:30
  • 3
    "it" refers to the tool AutoRaise, which must be compiled with command in the answer. make is a tool for automated building and the "flags" mentioned are just parameters passed to make (i.e., CXXFLAGS="-DOLD_ACTIVATION_METHOD -DEXPERIMENTAL_FOCUS_FIRST") to configure the build process. – dd23 Dec 13 '22 at 10:47
  • 2
    @Addlai, you OK there, bud? ;) – Ezekiel Victor Mar 17 '23 at 03:47
1

Note for users with Case Sensitive file systems (like many of us) the command should be defaults write com.apple.Terminal FocusFollowsMouse -string YES note the "T" in terminal. Otherwise terminal will ignore the setting. Also in Monterey I used Xcode to edit the plist and found that FocusFollowsMouse was already present but as a boolean and not a string. The entry must have type string with value YES to work properly.

Once the above changes were made terminal worked with FocusFollowsMouse on my new M1 MacBook Pro with Monterey.

1

Yabai Window Manager also has an autofocus implementation, along with window borders and other features. It may be overkill for this specific use case, but for people looking for this feature because they came from another TWM it may be helpful.

TYPKRFT
  • 158
  • 3
  • 14
-2

This is what I use successfully on Mojave and Big Sur on an M1 Mac:

defaults write com.apple.terminal FocusFollowsMouse -string true

Trev
  • 528
  • 4
  • 6
  • This doesn't work for all applications but I've found the answer: https://github.com/sbmpost/AutoRaise – DiF May 05 '21 at 06:23