Sublime Text 2 Key Bindings - Is there any way to detect left/right modifier keys?

2

Is it possible to make Left Alt+A and Right Alt+A do different things? And of course, other modifier keys.

If not, maybe the following idea would work? If AppleScript, Python, Ruby, Perl etc. can detect left/right modifiers I can set complicated key bindings in sublime text (like ["cmd+ctrl+shift+alt+a", "cmd+ctrl+shift+alt+a"]) and send those keystrokes with AppleScript or Automator?

Taylan

Posted 2013-06-16T08:32:58.487

Reputation: 652

Answers

2

You could remap the key combinations with KeyRemap4MacBook:

<?xml version="1.0"?>
<root>
    <appdef>
        <appname>SUBLIMETEXT</appname>
        <equal>com.sublimetext.2</equal>
    </appdef>
    <item>
        <name>test</name>
        <identifier>test</identifier>
        <only>SUBLIMETEXT</only>
        <autogen>__KeyToKey__ KeyCode::A, ModifierFlag::OPTION_R, KeyCode::F19</autogen>
    </item>
</root>

Or just change modifier keys:

<autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::CONTROL_L, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>

See the source for the key code values and predefined settings.

Lri

Posted 2013-06-16T08:32:58.487

Reputation: 34 501