Focus-follows-mouse (plus auto-raise) on Mac OS X

前端 未结 21 1197
挽巷
挽巷 2020-12-07 07:00

(I don\'t want to hear about how crazy I am to want that! :)

Focus-follows-mouse is also known as point-to-focus, pointer focus, and (in some implementations) sloppy

相关标签:
21条回答
  • 2020-12-07 07:46

    Steve Yegge wrote an essay about this a while back, where he tried and failed to write a suitable extension. I've since tried to find focus-follows-mouse applications for OS X and failed also.

    0 讨论(0)
  • 2020-12-07 07:46

    Experimenting with those options, my Command-Tab started to behave oddly. Here is the solution of how it gives focus to apps again:

    It appears that a previous feature, namely the ability for Terminal's window focus to change with mouse movement, is broken in 10.6 and causes Command-Tab to not transfer window focus correctly. To fix the problem, just paste the following command in a Terminal:

    defaults write com.apple.Terminal FocusFollowsMouse -string NO

    Then restart Terminal.

    0 讨论(0)
  • 2020-12-07 07:46

    You can't really do it well, because the Mac interface simply isn't designed with focus-follows-mouse (with or without auto-raise) in mind. I doubt that's going to change any time soon, and unless it does, everybody who tries to implement focus-follows-mouse will run into the same hurdles and wind up with an unsatisfactory result (to those who want such a thing).

    So, yes, you are crazy for wanting this — but for technical reasons. Get used to using the Mac on its own terms and I'm sure your desire to force it to behave just like whatever X11 stuff you used to use will subside in a bit as you find new efficient ways of working.

    0 讨论(0)
  • 2020-12-07 07:47

    Focus-follows-mouse is not a particularly suitable input method for OS X because its menu bar was designed to be at the top of the screen. When you move the mouse out of your application window to get to the menus, if it crosses any other application's windows on the way, the menu changes.

    So yes, in reply to dreeves comment, it works perfectly fine for Terminal (or for any other single application on the desktop), because the only other windows it's going to affect are Terminal windows, so the menu never changes as you switch windows. And it works fine for X11 because X11 apps generally have their menu bars embedded in the window, so you don't have to leave the window to access them.

    Of course you can work around the menu-changing issue by introducing an artificial delay before the focus changes and/or the menu switches, but it's never going to work as well as it does on other desktops.

    0 讨论(0)
  • 2020-12-07 07:48

    I currently use MondoMouse and even with its quirks I couldn't use my mac without it. They have a free trial and I would recommend it to everyone.

    MondoMouse

    0 讨论(0)
  • 2020-12-07 07:49

    Amethyst supports this feature. It can be easily installed with brew cask install amethyst.

    Here's the config file I use. It turns all the features off besides focus-follows-mouse. Save it to ~/.amethyst.

    {
        "LAYOUTS": "----------------------",
        "layouts": [
        ],
    
        "MODIFIERS": "----------------------",
        "Valid modifiers are": [
            "option",
            "shift",
            "control",
            "command"
        ],
    
        "mod1": [
        ],
        "mod2": [
        ],
    
        "COMMANDS": "----------------------",
        "Commands are": {
            "cycle-layout": "Cycle layout to the next layout",
            "cycle-layout-backward": "Cycle layout to the previous layout",
            "focus-screen-1": "Focus the main window on the first screen",
            "focus-screen-2": "Focus the main window on the second screen",
            "focus-screen-3": "Focus the main window on the third screen",
            "focus-screen-2": "Focus the main window on the second screen",
            "focus-screen-3": "Focus the main window on the third screen",
            "focus-screen-4": "Focus the main window on the fourth screen",
            "throw-screen-1": "Throw the focused window to the first screen",
            "throw-screen-2": "Throw the focused window to the second screen",
            "throw-screen-3": "Throw the focused window to the third screen",
            "throw-screen-4": "Throw the focused window to the fourth screen",
            "shrink-main": "Shrink the main pane of the current layout",
            "expand-main": "Expand the main pane of the current layout",
            "increase-main": "Increase the number of windows in the main pane",
            "decrease-main": "Decrease the number of windows in the main pane",
            "focus-ccw": "Move window focus counter-clockwise on the current screen",
            "focus-cw": "Move window focus clockwise on the current screen",
            "swap-ccw": "Swap focused window with the next window going counter-clockwi$
            "swap-cw": "Swap focused window with the next window going clockwise",
            "swap-main": "Swap focused window with the main window of its screen",
            "throw-space-1": "Throw the focused window to the first space",
            "throw-space-2": "Throw the focused window to the second space",
            "throw-space-3": "Throw the focused window to the third space",
            "throw-space-4": "Throw the focused window to the fourth space",
            "throw-space-5": "Throw the focused window to the fifth space",
            "throw-space-6": "Throw the focused window to the sixth space",
            "throw-space-7": "Throw the focused window to the seventh space",
            "throw-space-8": "Throw the focused window to the eighth space",
            "throw-space-9": "Throw the focused window to the ninth space",
            "throw-space-8": "Throw the focused window to the eighth space",
            "throw-space-9": "Throw the focused window to the ninth space",
            "toggle-float": "Toggle the focused window between being floating and tiled"
        },
    
        "screens": "3",
    
        "cycle-layout": {
            "mod": "mod1",
        },
        "cycle-layout-backward": {
            "mod": "mod2",
        },
        "select-tall-layout": {
            "mod": "mod1"
        },
        "select-wide-layout": {
            "mod": "mod1"
        },
        "select-fullscreen-layout": {
            "mod": "mod1"
        },
        "select-column-layout": {
            "mod": "mod1"
        },
            "mod": "mod1"
        },
        "focus-screen-1": {
            "mod": "mod1"
        },
        "focus-screen-2": {
            "mod": "mod1"
        },
        "focus-screen-3": {
            "mod": "mod1"
        },
        "focus-screen-4": {
            "mod": "mod1"
        },
        "throw-screen-1": {
            "mod": "mod2"
        },
        "throw-screen-2": {
            "mod": "mod2"
        },
        "throw-screen-3": {
            "mod": "mod2"
        },
        "throw-screen-4": {
            "mod": "mod2"
        "throw-screen-4": {
            "mod": "mod2"
        },
        "shrink-main": {
            "mod": "mod1"
        },
        "expand-main": {
            "mod": "mod1"
        },
        "increase-main": {
            "mod": "mod1"
        },
        "decrease-main": {
            "mod": "mod1"
        },
        "focus-ccw": {
            "mod": "mod1"
        },
        "focus-cw": {
            "mod": "mod1"
        },
        "swap-screen-ccw": {
            "mod": "mod2"
        },
        "swap-screen-cw": {
        },
        "swap-screen-cw": {
            "mod": "mod2"
        },
        "swap-ccw": {
            "mod": "mod2"
        },
        "swap-cw": {
            "mod": "mod2"
        },
        "swap-main": {
            "mod": "mod1"
        },
        "throw-space-1": {
            "mod": "mod2"
        },
        "throw-space-2": {
            "mod": "mod2"
        },
        "throw-space-3": {
            "mod": "mod2"
        },
        "throw-space-4": {
            "mod": "mod2"
        },
    
            "mod": "mod2"
        },
        "throw-space-5": {
            "mod": "mod2"
        },
        "throw-space-6": {
            "mod": "mod2"
        },
        "throw-space-7": {
            "mod": "mod2"
        },
        "throw-space-8": {
            "mod": "mod2"
        },
        "throw-space-9": {
            "mod": "mod2"
        },
        "toggle-float": {
            "mod": "mod1"
        },
        "toggle-tiling": {
            "mod": "mod2"
        },
        "display-current-layout": {
            "mod": "mod1"
        "display-current-layout": {
            "mod": "mod1"
        },
    
        "MISC": "----------------------",
        "floating": [],
        "float-small-windows": false,
        "mouse-follows-focus": false,
        "focus-follows-mouse": true,
        "enables-layout-hud": false,
        "enables-layout-hud-on-space-change": false
    }
    
    0 讨论(0)
提交回复
热议问题