Possible to remap CapsLock with modifier functionality?

I want the Caps Lock key to be left parenthesis, as in (, and right shift + Caps Lock to be right parenthesis, as in ).

Is this possible in OS X? Seil (https://pqrs.org/osx/karabiner/seil.html.en) doesn't seem to be able to do this.

I tried using Seil to map to a garbage key code, and then using Karibiner to map from that key code to another, but it didn't work. Tips?


Use Seil to map caps lock to some key like F19. Then install Karabiner and save a file like this as ~/Library/Application Support/Karabiner/private.xml:

<?xml version="1.0"?>
<root>
  <item>
    <name>custom</name>
    <identifier>custom</identifier>
    <autogen>__KeyToKey__ KeyCode::F19, ModifierFlag::NONE, KeyCode::KEY_9, ModifierFlag::SHIFT_L</autogen>
    <autogen>__KeyToKey__ KeyCode::F19, VK_SHIFT, KeyCode::KEY_0, ModifierFlag::SHIFT_L</autogen>
  </item>
</root>

Then open the Karabiner application, press the ReloadXML button, and click the checkbox for the setting.

If others search for how to for example map pressing caps lock to escape and holding caps lock to control, use KeyOverlaidModifier:

__KeyOverlaidModifier__ KeyCode::F19, KeyCode::CONTROL_L, KeyCode::ESCAPE