Export xml for keymap "parent" for batch changes to modifier keys

I use both PC & Mac, and would like to make both use similar keyboard layout for modifier keys.

To do that, I changed the Mac modifier keys (in System Preferences->Keyboad->Modifier Keys) to be as follows: Control=>Command, Option=>Control, Command=>Alt/Option.  This gives me the ability to use Ctrl+C, Ctrl+V, etc, in all applications as if I were using Command+C, Command+V, etc.  This works great for all applications, except AppCode using a Resharper or Resharper OSX keymap.

Since the Appcode Resharper and Resharper OSX keymaps already tried to do the "right thing" by reassigning Ctrl as the modifier key for Copy, Refactor, etc, now with my modifier keys redefined in System Preferences, I have my keyboard layout broken again.

Currently I can either have the global modifier keys working the way I want, OR the AppCode keys working the way I want, but not both.  :-(

One solution is to simply change the AppCode Resharper / OSX keymaps, but as far as I can tell, that is a something I would have to do manually through the GUI for each setting.  I see there is a way to export keymap customizations, but not "parent keymaps."  I seems to me, if I could export a parent keymap, I could do a global search&replace on specific modifier keys in the xml and be done with it much more efficiently.

Is there a way to export parent keymaps?  Or is there a link, or can you send me the xml files for the AppCode Resharper / OSX parent keymaps?

Thanks in advance,
Cesar

__________________

PS: I know another alternative would be to have the Mac OS contextually change the global modifier keys depending on the current application.  USBOverdrive actually works that way, but only for external USB keyboards, not the built in keyboard.  And unfortuneately KeyboardRemap4Macbook/karabiner doesn't work on a per-application basis...  But if anyone knew of another such utility that did, that would be a great, and possibly more simple solution as well.

1 comment
Comment actions Permalink

I found my own solution.

I turns out that KeyboardRemap4Macbook/Karabiner can change keymaps on a per application basis.  You just have to add some custom xml.  I'm pasting sample xml definitions I used below in case anyone else is interested in doing the same.

Now, I can use the Ctrl key in AppCode and any other application in the same way I can in Windows.  I also switch the position of Alt/Option to be in the same position as in a Windows keymap so that whether I'm working on Windows+VisualStudio+ReSharper or Mac+AppCode, my fingers will always fiind the keys in the same location.

I consider the below version 1, since no doubt I will modify them further.  For example, I can't drag+Ctrl to copy, so I may want to enable that later.  Anyway, the below is a start...

Cheers!
Cesar


PS: This page https://pqrs.org/osx/karabiner/xml.html.en#appdef provides reference info on how to create custom mappings as those below.  Note I've also attached the below xml file to this post.

 
<?xml version="1.0"?>
<root>
    <appdef>
        <appname>AppCode</appname>
        <equal>com.jetbrains.AppCode</equal>
    </appdef>

    <item>
        <name>Global Remapping of Modifier Keys Except in AppCode</name>
        <identifier>private.cvr.AppCode.GlobalRemapOfModifierKeysExceptInAppCode</identifier>
        <not>AppCode</not>
        <appendix>Globally switch modifier keys to use a more Windows-like keymap except in AppCode, which has its own keymap. This remapping will do the following:</appendix>
        <appendix> - Command to Option</appendix>
        <appendix> - Control to Command</appendix>
        <appendix> - Command to Option</appendix>
        <autogen>__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L</autogen>
        <autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R</autogen>
        <autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::COMMAND_L</autogen>
        <autogen>__KeyToKey__ KeyCode::CONTROL_R, KeyCode::COMMAND_R</autogen>
        <autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::CONTROL_L</autogen>
        <autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::CONTROL_R</autogen>
    </item>

    <item>
        <name>Remap Alt/Option and Command keys in AppCode</name>
        <identifier>private.cvr.AppCode.RemapAltAndCommandInAppCode</identifier>
        <only>AppCode</only>
        <appendix>Swap Alt/Option and Command keys to be in Windows-like keymap in AppCode to get a full, awesome ReSharper experience.</appendix>
        <autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L</autogen>
        <autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::COMMAND_R</autogen>
        <autogen>__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L</autogen>
        <autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R</autogen>
    </item>
</root>


Attachment(s):
private.xml
0

Please sign in to leave a comment.