Monday, November 25, 2013

KeyRemap4MacBook implement XWindows auto select with Mouse Gestures.

I love the Xwindows feature that you can auto copy selected text from a cursor selection. So this is the scenario, when I select a piece of text I would like it to be stored in the buffer/clipboard with control-C after I lift my mouse button. I don't need the paste function however could easily be implemented as well.
With KeyRemap4MacBook your can rearrange your input events. Here the snippet I use for the TERMINAL application to do just so:
  <item>
   <name>Autoselect Copy</name>
   <identifier>private.autoselect_copy</identifier>
   <only>TERMINAL</only>
   <autogen>
    __PointingButtonToKey__
    PointingButton::LEFT, ModifierFlag::NONE,
    KeyCode::VK_MODIFIER_EXTRA1,

    Option::KEYTOKEY_BEFORE_KEYDOWN,
    KeyCode::VK_MOUSEKEY_LOCK_BUTTON_LEFT,
    KeyCode::VK_LOCK_EXTRA2_FORCE_ON,
    <!-- VK_LOCK_EXTRA2 is necessary for Middle Button to Command+Tab (Switch 
     Applications) -->

    Option::KEYTOKEY_AFTER_KEYUP,
    KeyCode::VK_MOUSEKEY_LOCK_BUTTON_ALL_FORCE_OFF,
    KeyCode::C, ModifierFlag::COMMAND_L,
    KeyCode::VK_LOCK_EXTRA2_FORCE_OFF
   </autogen>
  </item>

After this I can paste the text... in this example my stickies.

No comments:

Post a Comment