我正在尝试找到一种仅使用左侧选项键作为 osx 终端中的元键的方法,但将右侧选项保留为正常功能(特殊字符 #、@ 等)。
有没有办法配置它以这种方式工作?(基本上我想实现相同的功能,iterm 必须只使用一个选项作为元选项,另一个作为普通选项)
编辑:此外,也欢迎使用 Karabiner 的解决方案
从 ant 的解决方案开始并在 Karabiner.app 包中挖掘以查看它是如何工作的,我找到了一种仅使用 Karabiner 使其工作的方法:
只需将您的 Karabiner private.xml(在 中找到~/Library/Application Support/Karabiner/private.xml
)编辑为以下内容:
<?xml version="1.0"?>
<root>
<appdef>
<appname>TERMINAL</appname>
<equal>com.apple.Terminal</equal>
</appdef>
<item>
<name>Option-Left to Meta in Terminal</name>
<only>TERMINAL</only>
<identifier>private.optionltometa</identifier>
<autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::VK_MODIFIER_EXTRA1</autogen>
<include path="/Applications/Karabiner.app/Contents/Resources/include/checkbox/apps/terminal/meta_modifier_key.xml">
<replacementdef>
<replacementname>BEFORE</replacementname>
<replacementvalue>KeyCode::ESCAPE</replacementvalue>
</replacementdef>
<replacementdef>
<replacementname>AFTER</replacementname>
<replacementvalue></replacementvalue>
</replacementdef>
</include>
</item>
</root>
然后启动 Karabiner 并按下Change Key选项卡中的Reload XML按钮(我使用的是 10.22.0 版本,可能在较新版本中选项卡名称已更改)
这种方法的优点是,当您不使用 Terminal 时,它不会禁用您的左选项键,就像使用 Seil 的解决方案一样。
它现在支持延迟“Option::KEYTOKEY_DELAYED_ACTION”
https://pqrs.org/osx/karabiner/xml.html.en#syntax-KeyToKey-options _ _