How to Reverse Scrollwheel in Adobe Illustrator (holding Alt) using Karabiner

keybindingskeyboardmagic-trackpadmousescrolling

Using Karabiner I'm trying to fix the annoying scrollwheel-zoom inconsistencies between Photoshop and Illustrator, i.e. the Alt + Scrollwheel Up/Down behavior.

I favor Photoshop's way of zooming: Alt + ScrollWheel UP zooms in and vice versa.

Therefore I've edited my private.xml in Karabiner and managed to get the reverse scrolling working and restricting it to Illustrator only. BUT I can't find a way to get it working conditionally, meaning, now it has reversed scrolling in each and every situation, whereas I only want it to come in effect when zooming (i.e. when I hold down Alt and scroll).

Here's the exact logic I'm trying to achieve:


Only reverse scrollwheel when holding down Alt in Illustrator.


My current private.xml looks like this; how can I amend this correctly?

<?xml version="1.0"?>
<root>
  <item>
    <name>My Custom Remaps</name>

    <item>
      <name>Reverse Vertical ScrollWheel in Illustrator (holding down Alt)</name>
      <identifier>private.remap.reverse_vertical_scrolling</identifier>
      <only>ILLUSTRATOR</only>
      <autogen>
        __FlipScrollWheel__
        Option::FLIPSCROLLWHEEL_VERTICAL,
      </autogen>
    </item>

  </item>
</root>

Best Answer

Use Option::KEYTOKEY_BEFORE_KEYDOWN together with KeyCode::VK_CONFIG_:

<?xml version="1.0"?>
<root>
  <item>
    <name>invertscrolling</name>
    <identifier vk_config="true">invertscrolling</identifier>
    <autogen>__FlipScrollWheel__ Option::FLIPSCROLLWHEEL_VERTICAL</autogen>
  </item>
  <item>
    <name>test</name>
    <identifier>test</identifier>
    <only>ILLUSTRATOR</only>
    <autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::OPTION_L,
    Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::VK_CONFIG_TOGGLE_invertscrolling,
    Option::KEYTOKEY_AFTER_KEYUP, KeyCode::VK_CONFIG_TOGGLE_invertscrolling</autogen>
    <autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::OPTION_L,
    Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::VK_CONFIG_TOGGLE_invertscrolling,
    Option::KEYTOKEY_AFTER_KEYUP, KeyCode::VK_CONFIG_TOGGLE_invertscrolling</autogen>
  </item>
</root>

More information about KeyRemap4MacBook:

http://pqrs.org/macosx/keyremap4macbook/xml.html.en
https://raw.github.com/tekezo/KeyRemap4MacBook/master/Tests/lib/string/data/checkbox.xml
http://osxnotes.net/keyremap4macbook.html