Unmap key combinations in KeyRemap4Macbook This is a follow up to How can I map the Windows key to option in Microsoft Remote Desktop version 8?. The answers to that question are a huge timesavers for OSX RDC users; however, there are some key combinations I don't want remapped. For example, Command+Q and Command+W would ideally still function the same as they do before remapping. 

I tried adding this definition:

&lt;autogen&gt;
    __KeyToKey__ 
    KeyCode::Q, ModifierFlag::COMMAND_L, 
    KeyCode::Q, ModifierFlag::COMMAND_L
&lt;/autogen&gt;


But to no effect.

Update: here is the full private.xml:

&lt;root&gt;
    &lt;appdef&gt;
        &lt;appname&gt;Microsoft Remote Desktop&lt;/appname&gt;
        &lt;equal&gt;com.microsoft.rdc.mac&lt;/equal&gt; 
    &lt;/appdef&gt;
    &lt;item&gt;
        &lt;name&gt;Swap command and option in Remote Desktop&lt;/name&gt;
        &lt;identifier&gt;private.remotedesktopswapcommandandcontrol&lt;/identifier&gt;
        &lt;only&gt;Microsoft Remote Desktop&lt;/only&gt;
        &lt;autogen&gt;
            __KeyToKey__ 
            KeyCode::Q, ModifierFlag::COMMAND_L, 
            KeyCode::Q, ModifierFlag::COMMAND_L
        &lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::TAB, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, KeyCode::TAB, ModifierFlag::COMMAND_L&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::OPTION_R, KeyCode::COMMAND_R&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R&lt;/autogen&gt;
    &lt;/item&gt;
&lt;/root&gt;
The documentation suggests that these shouldn't conflict:

&lt;autogen&gt;
   __KeyToKey__
   KeyCode::Q, ModifierFlag::COMMAND_L | ModifierFlag::NONE,
   KeyCode::Q, ModifierFlag::COMMAND_L | ModifierFlag::NONE,
&lt;/autogen&gt;
&lt;autogen&gt;__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L&lt;/autogen&gt;


However, the second &lt;autogen&gt; will override the COMMAND_L of the first. The solution is counterintuitive:

&lt;root&gt;
    &lt;appdef&gt;
        &lt;appname&gt;Microsoft Remote Desktop&lt;/appname&gt;
        &lt;equal&gt;com.microsoft.rdc.mac&lt;/equal&gt; 
    &lt;/appdef&gt;
    &lt;item&gt;
        &lt;name&gt;Swap command and option in Remote Desktop&lt;/name&gt;
        &lt;identifier&gt;private.remotedesktopswapcommandandcontrol&lt;/identifier&gt;
        &lt;only&gt;Microsoft Remote Desktop&lt;/only&gt;            
        &lt;autogen&gt;__KeyToKey__ KeyCode::TAB, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, KeyCode::TAB, ModifierFlag::COMMAND_L&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::OPTION_R, KeyCode::COMMAND_R&lt;/autogen&gt;
        &lt;autogen&gt;__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R&lt;/autogen&gt;
        &lt;autogen&gt;
            __KeyToKey__
            KeyCode::Q, VK_OPTION | ModifierFlag::NONE,
            KeyCode::Q, VK_COMMAND | ModifierFlag::NONE,
        &lt;/autogen&gt;
    &lt;/item&gt;
&lt;/root&gt;


In this case Cmd+Q is remapped to Opt+Q but then Opt+Q is remapped back to `Cmd+Q'.