(我不想听到我有多疯狂!:)
焦点跟随鼠标也称为点对焦,指针焦点,以及(在某些实现中)草率焦点.[添加其他条款,使其更易于搜索!] X-mouse
您可以通过在命令行发出以下命令来为Terminal.app执行此操作:
defaults write com.apple.Terminal FocusFollowsMouse -bool true
对于X11应用程序,您可以这样做:
defaults write com.apple.x11 wm_ffm -bool true
在Snow Leopard中,请改用:
defaults write org.x.X11 wm_ffm -bool true
显然有一个名为CodeTek虚拟桌面的程序,它将在系统范围内模拟它,但它的成本为$$(并且他们从未获得OSX Leopard的版本).
Steve Yegge不久前写了一篇关于这篇文章的文章,在那里他尝试了并且未能写出合适的扩展.我已经尝试为OS X找到焦点跟随鼠标应用程序,但也失败了.
Focus-follow-mouse不是特别适合OS X的输入方法,因为它的菜单栏设计在屏幕的顶部.当您将鼠标移出应用程序窗口以进入菜单时,如果它在途中穿过任何其他应用程序的窗口,则菜单会更改.
所以是的,在回复dreeves评论时,它对终端(或桌面上的任何其他单个应用程序)完全正常,因为它将影响的唯一其他窗口是终端窗口,因此菜单永远不会随着您切换窗口而改变.它适用于X11,因为X11应用程序通常在窗口中嵌入了菜单栏,因此您无需离开窗口即可访问它们.
当然,您可以通过在焦点更改和/或菜单切换之前引入人工延迟来解决菜单更改问题,但它永远不会像在其他桌面上那样工作.
虽然这远不是一个完整的解决方案,但OSX(10.11)中内置的两个方便的操作是:
^ - 单击(控制选项 - 单击) - 切换焦点而不抬起窗口
⌘-单击(按住命令单击) - 在窗口中单击而不切换焦点
不确定何时引入这些快捷方式,因为我无法在任何地方找到它们.
菜单问题是传统焦点跟随鼠标不起作用的唯一原因.
这是另一种选择:在键盘上按下键之前不要改变焦点.这将覆盖95%的焦点跟随鼠标的使用案例,并将使这个古怪的X用户真的很开心.我不知道有多少次我会在Chrome浏览器中滚动浏览网页,然后点击Command-T打开一个新标签页,然后找到终端中的标签页.如果我的大脑在使用Mac的8个月内没有发现它,它永远不会.
紫水晶支持此功能.它可以很容易地安装brew cask install amethyst
.
这是我使用的配置文件.除焦点跟随鼠标外,它还会关闭所有功能.保存到~/.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 }
所以我决定再次改进我在MouseFocus.app上所做的工作,这仍然有一些缺陷.现在已经修好了.我将整个事物重命名为"AutoRaise"以更好地反映此工具的作用:当您将鼠标悬停在窗口时,它将被提升到前面(延迟您选择)并获得焦点.该工具可以在这里下载.要使用它,请将其复制到您的/ Applications /文件夹,确保它是可执行的(chmod 700 AutoRaise).然后在Finder中双击它.要快速打开/关闭它,您可以使用下面的AppleScript并将其粘贴到automator 服务工作流程中.然后通过"系统偏好设置"|"键盘"|"快捷方式"将创建的服务绑定到键盘快捷键
更新(29-03-2017):AutoRaise二进制文件已更新.如果在命令行上未指定延迟,它现在还将在同一文件夹中查找AutoRaise.delay文件.这在使用下面的AppleScript时特别有用,因为'launch application'不支持命令行参数.延迟应以50ms为单位.例如,为了指定150ms的延迟,在终端中运行此命令一次:'echo 3> AutoRaise.delay'
on run {input, parameters} tell application "Finder" if exists of application process "AutoRaise" then quit application "/Applications/AutoRaise" display notification "AutoRaise Stopped" else launch application "/Applications/AutoRaise" display notification "AutoRaise Started" end if end tell return input end run
Codetek有一个产品可以做到这一点,但他们从未发布过Leopard或更高版本的版本.
MondoMouse可以做一些焦点跟随鼠标,但不能自动加注.甚至焦点跟随鼠标也被破坏了.例如,它不使用命令选项卡发挥出色(如果你命令选项卡到一个新的应用程序,不要触摸鼠标,那么它应该不是焦点切换回哪里鼠标指针恰好是-我我确实知道Linux中的所有实现都是正确的,但是MondoMouse没有这样做.
您可以为终端窗口启用焦点跟随鼠标(无自动)(只需在终端中执行以下操作):
defaults write com.apple.Terminal FocusFollowsMouse -string YES
对于X11窗口同样如此:
defaults write org.x.X11 wm_ffm -bool true
(对于10.5.5之前的mac版本,这是:
defaults write com.apple.x11 wm_ffm true
)
我不知道任何其他支持它的应用程序.
我目前使用的是MondoMouse,即使有它的怪癖,如果没有它,我也无法使用我的mac.他们有免费试用版,我会推荐给大家.
MondoMouse
chunkwm也支持这个(默认情况下我相信): chunkwm
有趣的是,Leopard默认启用了一种焦点跟随鼠标(无人机自动).滚轮在未聚焦的窗口中工作.
现在可以在macOS上关注鼠标了,在我的情况下,可以使用chunkwm在Mojave中进行鼠标操作。请参阅此堆栈溢出响应以获取“不自动提高”解决方案。通过离开激活自动提高
chunkc set ffm_disable_autoraise 0
在中~/.chunkwmrc
。
编辑 2019-09-12:
chunkwm已被yabai取代。安装:
brew tap koekeishiya/formulae
brew install yabai
mkdir -p ~/.config/yabai/
printf 'yabai -m config focus_follows_mouse autoraise' >> ~/.config/yabai/yabairc
brew services start yabai