更改 OSX 的功能键行为,但仅限于某些 f 键

更改 OSX 的功能键行为,但仅限于某些 f 键

我非常怀疑这是否可能,但值得一试......

我有一台新的 MacBook Pro,我发现自己(作为 VIM 用户)经常在尝试按 ESC 键返回正常模式时意外按到 F1(降低亮度)键。我已在 .vimrc 中将 F1 重新映射到 ESC,但似乎除非我按住 fn,否则该键不会注册为 F1。我知道如何在“系统偏好设置”中更改此行为,但有些功能键(如音量控制键)我希望保持原样。

抱歉,如果这令人困惑,基本上我想知道的是我是否可以将亮度键默认设置为 F1 和 F2,同时将音量控制键默认设置为音量控制......

答案1

你要函数翻转

答案2

另一个选择是使用私有文件与 KeyRemap4MacBook 类似:

<?xml version="1.0"?>
<root>
  <item>
    <name>fkeys</name>
    <identifier>fkeys</identifier>
    <only>FKEYS</only>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_DOWN, KeyCode::F1</autogen>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_UP, KeyCode::F2</autogen>
    <autogen>__KeyToKey__ KeyCode::F1, KeyCode::BRIGHTNESS_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F2, KeyCode::BRIGHTNESS_UP</autogen>
  </item>
</root>

当 MacVim 位于最前面时,这将翻转所有 F 键:

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>MACVIM</appname>
    <equal>org.vim.MacVim</equal>
  </appdef>
  <item>
    <name>fkeys</name>
    <identifier>fkeys</identifier>
    <only>MACVIM</only>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_DOWN, KeyCode::F1</autogen>
    <autogen>__KeyToKey__ KeyCode::BRIGHTNESS_UP, KeyCode::F2</autogen>
    <autogen>__KeyToKey__ KeyCode::EXPOSE_ALL, KeyCode::F3</autogen>
    <autogen>__KeyToKey__ KeyCode::LAUNCHPAD, KeyCode::F4</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::KEYBOARDLIGHT_LOW, KeyCode::F5</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::KEYBOARDLIGHT_HIGH, KeyCode::F6</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PREV, KeyCode::F7</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PLAY, KeyCode::F8</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_NEXT, KeyCode::F9</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_MUTE, KeyCode::F10</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_DOWN, KeyCode::F11</autogen>
    <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_UP, KeyCode::F12</autogen>
    <autogen>__KeyToKey__ KeyCode::F1, KeyCode::BRIGHTNESS_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F2, KeyCode::BRIGHTNESS_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::F3, KeyCode::EXPOSE_ALL</autogen>
    <autogen>__KeyToKey__ KeyCode::F4, KeyCode::LAUNCHPAD</autogen>
    <autogen>__KeyToKey__ KeyCode::F5, ConsumerKeyCode::KEYBOARDLIGHT_LOW</autogen>
    <autogen>__KeyToKey__ KeyCode::F6, ConsumerKeyCode::KEYBOARDLIGHT_HIGH</autogen>
    <autogen>__KeyToKey__ KeyCode::F7, ConsumerKeyCode::MUSIC_PREV</autogen>
    <autogen>__KeyToKey__ KeyCode::F8, ConsumerKeyCode::MUSIC_PLAY</autogen>
    <autogen>__KeyToKey__ KeyCode::F9, ConsumerKeyCode::MUSIC_NEXT</autogen>
    <autogen>__KeyToKey__ KeyCode::F10, ConsumerKeyCode::VOLUME_MUTE</autogen>
    <autogen>__KeyToKey__ KeyCode::F11, ConsumerKeyCode::VOLUME_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F12, ConsumerKeyCode::VOLUME_UP</autogen>
  </item>
</root>

答案3

您可以反转 fn 行为并使用类似火花将您需要的按键映射到媒体操作。

答案4

另一个相关的应用程序,你可能会发现它对你很有用,比如你想在一个 OSX 应用程序中使用 F1-F12 键,而在其他应用程序中使用亮度/音量/等键。保拉

除了跟踪应用程序焦点的功能键模式之外,Paula 还提供了可配置的热键组合来切换当前模式。

相关内容