使用键盘Maestro拦截系统篡改的键盘快捷键

几周前,当Apple发布Mac OS X 10.4.8时,我写了一篇关于新版本的内容缩放使用滚轮功能在“系统偏好设置”的“键盘和鼠标”面板中我注意到以下一个非常酷的新功能的下面的缺点:

My only gripe is the ⌘⌥\ (Command-Option-Backslash) shortcut attached to the smoothing optionIf you turn the “Zoom using scroll wheel” option on, this keyboard shortcut is applied system-wide, even when you aren’t zoomingThat’s a problem if you’re using any applications that use this keystroke — and since BBEdit and Mailsmith use this for the Hard Wrap command, and I’ve got about 10 years of muscle memory using this command with this shortcut every single day, it’s a problem for me.

[...]

And even if it really does deserve a system-wide shortcut, it ought to be configurable using the Keyboard Shortcuts tab in the Keyboard & Mouse prefs panelMost of the other system-wide default keyboard shortcuts can be changed or just plain turned off in the Keyboard Shortcuts tab; but, alas, not this ⌘⌥\ zoom-smoothing shortcut.

只是为了澄清与BBEdit的冲突:BBEdit的“常规”Hard Wrap命令(“文本”菜单中的“Hard Wrap ...”)的默认快捷方式是Command-Backslash这会产生(或者我应该说“下降”?)硬包装表,您可以在其中指定文本包装选项The Command-Option-Backslash shortcut is for the “don’t show me the configuration sheet, just do it using my current settings” Hard Wrap command (“Hard Wrap”, no ellipses, in the Text menu; when you hold down the Option key “Hard Wrap…” turns into “Hard Wrap”).

我真的每天都在使用这个快捷方式它只是那些在我的肌肉记忆深处被烧毁的键盘序列之一不像⌘Z,⌘X,⌘C和⌘V那么远,但相当远。

因此,问题在于:我希望能够使用新的Zoom With Scroll Wheel功能,但我不想在BBEdit和Mailsmith中学习用于硬包装的新键盘快捷键。

键盘大师救援。

Keyboard Maestro是来自Stairways Software(Interarchy的制造商)的20美元实用程序Stairways称它为“宏观实用程序”,这与任何描述一样好Keyboard Maestro有两个软件组件:

  • The main Keyboard Maestro application — this is what you use to diddle with options, configure keyboard shortcuts, and define and edit your macros.
  • Keyboard Maestro Engine — an invisible background application that launches as a login item; this is the software that “listens” for your macro shortcuts and executes the associated macros.

不涉及haxie或输入管理器欺骗引擎很瘦,意味着:它只消耗696个千字节在我的PowerBook上的私人记忆。

当打开缩放滚轮功能时,像BBEdit这样的常规应用程序不再“看到”该键序列 - 系统在较低级别使用它并且不会将其传递给它但是,键盘Maestro仍然可以看到它,因此您可以将相同的序列分配给宏。

我做的第一件事是在Keyboard Maestro中创建一个新的宏组,并将其命名为“Bare Bones”每个组中的宏可以在系统范围内应用,也可以仅应用于某些应用程序列表对于这个组,我将其设置为仅适用于BBEdit和Mailsmith。

该组包含一个宏,我将其命名为“Hard Wrap”,并分配了触发器Command-Option-Backslash。

我想到了两种方法来使用Keyboard Maestro宏动作来调用BBEdit的Hard Wrap命令The first is “Select Menu Item”; you specify the name of the menu and the name of the menu command, then when you hit the macro’s keyboard shortcut, Keyboard Maestro simulates the selection of that menu itemThe second would be to first assign a new keyboard shortcut to this command from with BBEdit’s own preferences window; then use Keyboard Maestro’s “Simulate Keypress” action to fire off the new shortcut you assigned to the Hard Wrap command.

这两种技术都有效,但都不是完美的“选择菜单项”技术的一个小问题是,在模拟菜单项的选择之前,Keyboard Maestro会向应用程序发送“激活”事件因此,所有属于BBEdit的当前窗口(或者您正在使用此宏的任何应用程序)都会弹出没什么大不了的,但有些分散注意力。

The problem with the “set a new shortcut in BBEdit, then use Keyboard Maestro to simulate that shortcut using the old shortcut as the trigger” technique is that it doesn’t quite work reliably if the new shortcut you specify for the command in BBEdit uses the same keys as the Keyboard Maestro macro trigger例如,我尝试将BBEdit中的快捷方式从Command-Option-Backslash更改为控制-Option-Backslash; but that only worked from Keyboard Maestro when I very quickly tapped the Command-Option-Backslash macro trigger我怀疑问题是如果你不输入序列很快,您在键盘上按下的键与键盘Maestro生成的模拟按键事件冲突在我将BBEdit中的快捷方式切换到完全偏离Control-F1之后,它运行正常。

所以,这就是我最后做的事情我将BBEdit和Mailsmith中Hard Wrap命令的键盘快捷键更改为Command-Option-Return这与Command-Option-Backslash几乎相同(至少在美国键盘布局),它使一些助记符有意义,使用Return键添加硬换行符的命令在Keyboard Maestro中,我将宏设置为使用“选择菜单项”操作My goal is to wean myself away from the old shortcut to the new one; but until the new muscle memory kicks in, the old shortcut will still work, albeit with the minor annoyance of all current BBEdit (or Mailsmith) windows popping to the front, which annoyance I’m thinking might serve as encouragement to remember to use the new shortcut.

理想情况下,我尝试使用尽可能少的系统修改运行,当我使用一个简单的习惯时,我试图打破这个习惯有时需要一段时间 - 我跑了Unsanity的WindowShade X.至少在一年前的10.1岁时,我的窗户阴影消失了。

附加物

  • Even though Keyboard Maestro still sees keyboard shortcuts that are used by the system, it doesn’t他们So while you can assign Command-Option-Backslash to a Keyboard Maestro macro, the system still sees it, too — so when you invoke a macro assigned to this trigger, it works, but the system willtoggle the anti-aliasing setting for screen zooming.

  • 键盘Maestro不是通用二进制文件It does work fine under Rosetta, however.

  • You can probably do something similar using other utilities such asQuicKeys要么的iKey, but I didn’t try any other software because I already had a license for Keyboard Maestro. If anyone sends me reports about other utilities that can see and use keyboard shortcuts claimed by the system, I’ll list them in an update.

以前: 处理流程
下一个: 会员续订