68

I sometimes have to use Microsoft Remote Desktop Connection for Mac for remote access to a Windows 7 machine from an iMac running MacOS X 10.6.6 (Snow Leopard).

Making the mental switch to use the Control key CTRL in place of the Command key CMD while in the Remote Desktop window (e.g. CTRL-C to copy instead of CMD-C) is a pain and a source of constant errors.

I would like to be able to map the CMD key to output a CTRL key on my Mac, but only when accessing the Microsoft Remote Desktop Connection for Mac application. Remote Desktop Connection lets you map a number of other keys via its Preferences . . . but not the CMD key.

I.e. in any other Mac application, CMD would act like CMD. However, in Microsoft Remote Desktop Connection for Mac, CMD would act like CTRL.

  • 1
    Eh, well darn. 10 minutes after submitting the question, I found the answer myself. A program called KeyRemap4MacBook does exactly what I needed for the Remote Desktop Connection client. – Greg R. Mar 28 '11 at 19:08
  • How did you map cmd+space for switching languages? – dmiandre Sep 28 '16 at 8:53
  • dmiandre, I didn't because I don't have any need to switch languages. Sorry. – Greg R. Sep 29 '16 at 15:32
49

Answering my own question. :-P

Shortly after posting, I googled across an application called Karabiner that does precisely what I needed it to do (in addition to a lot of other stuff).

Specifically, you can map the left and right Command keys to be Control keys in only Remote Desktop Connection and VMs.

| improve this answer | |
  • 1
    Omg, thank you so much. Here are my settings for Karabiner to enable Shift+Enter shortcut for newline in Messages app. – DanSkeel Jun 19 '15 at 15:19
  • 3
    I'm on Mac Sierra with Karabiner-Elements, and even I added the mapping of Ctrl to Cmd and Cmd to Ctrl, Microsoft Remote Desktop still register Ctrl as Windows key and Cmd as Ctrl key. Any idea ? – Dio Phung Dec 9 '16 at 22:04
  • 5
    Go to the Complex Modifications tab, click Add rule at the bottom, click Import more rules from the internet, click Application Specific, find the one that says Remote Desktop and click Import. Once it's imported, you'll see it in the list and just click Enable. Worked right away for me and only in the Remote Desktop app which is perfect. Didn't even have to restart the app or anything. – Ben Baron Jun 6 '18 at 2:09
  • I'm using RemotePC to access a work Windows machine from personal Mac. Karabiner did the job of mapping my Command key to Ctrl perfectly. I've shared my custom Karabiner Rule here if anyone needs it. Thanks! – alexkb Apr 22 at 7:00
  • Karabiner has provided store to achieve this feature, Awesome! i think long long ago, need separate script to make setting for special application – Xin Meng Sep 2 at 7:40
27

Microsoft Remote Desktop beta adds support for Cmd+X/C/V as well as Ctrl+X/C/V to cut/copy/paste within a remote session. (Note: Clipboard redirection will be available in a later update.)


You can also add custom mappings by navigating to the Resources/Keyboard directory within the application contents, and opening the ClipboardActionTransformations.xml file in a plain text editor.

<layout name="default">
<transformations>
    <!-- Command+X to Control+X -->
    <transform>
        <from command="1" key="X" />
        <to control="1" key="X" />
    </transform>
    <!-- Command+C to Control+C -->
    <transform>
        <from command="1" key="C" />
        <to control="1" key="C" />
    </transform>
    <!-- Command+V to Control+V -->
    <transform>
        <from command="1" key="V" />
        <to control="1" key="V" />
    </transform>
    <!-- Command+Z to Control+Z -->
    <transform>
        <from command="1" key="Z" />
        <to control="1" key="Z" />
    </transform>
</transformations>
</layout>

Update

You can simply set this checkbox in the Preferences / General section:

MS Remote Desktop Client (beta) Preferences General


Update 2

Some were suspicious of the hockeyapp site, despite the author being "Microsoft Remote Desktop". This TechNet blog post from microsoft.com announces the beta app and provides the same hockeyapp URL.

Update 3

For those not willing to use Karabiner, there is little documentation on ClipboardActionTransformations.xml (above). However, the following keys can be mapped: LeftArrow, etc., Slash, Space, Period, LeftBracket, RightBracket, F1, etc. Also, Shift combinations can be mapped with Shift="1".

| improve this answer | |
  • 1
    "the Resources/Keyboard directory within the application contents"... where? – Chris Nov 4 '16 at 9:32
  • 2
    @Chris, it can be also be done in GUI: "Preferences" - "General". The checkbox "Use Mac shortcuts for Cut, Copy, and Paste" – Dmitry Yantsen Nov 21 '16 at 9:02
  • 2
    Also, dont mistake "Microsoft Remote Desktop Beta" for just "Microsoft Remote Desktop" as I did. – Dmitry Yantsen Nov 21 '16 at 9:02
  • Beta it is. Just wanted to note for the rest of the readers that the none-Beta version doesn't add support Cmd+X/C/V. You need the Beta version. – Chris Nov 22 '16 at 8:04
  • Just edited this file as directed. Added support for L,T(chrome new tab ,W close), S-Save, D-(my delete line intellij). – user895861 Dec 6 '16 at 21:03
18

Install the application Karabiner

Once installed, open Karabiner:

  • From the 'Change Key' tab, expand the 'For Applications' section

  • 'Enable at only Remote Desktop Connection Client' sub-section

  • Check 'Change command key to control key in RDC'

Now when you use the new RDP app, you can continue to use Cmd instead of Ctrl.

| improve this answer | |
  • 1
    Ugh, not currently compatible with sierra though... – user895861 Dec 6 '16 at 18:12
  • on Sierra, try Karabiner-Elements which is a simpler version of Karabiner. However, under Microsoft Remote Desktop, Ctrl key is recognized as Windows key and Cmd key is recognized as Ctrl key. – Dio Phung Dec 9 '16 at 22:05
  • The latest version of Microsoft Remote Desktop does not recognise the Ctrl key as Windows key and Cmd key is recognized as Ctrl key (I am using Version 8.0.36) – George Filippakos Dec 10 '16 at 21:26
  • I successfully set up a keyboard map switch only in Teamviewer app. Which is great: forum.keyboardmaestro.com/t/switching-command-and-control-keys/… – Mau Jul 24 '18 at 1:00
1

Like previous answers, I too, used Karabiner. Most Excellent App!

What I did differently tho, was to add a custom key mappings to mitigate the MAC command v. control buttons in the Terminal.

In my situation, I'm using a Logitech keyboard sooo no Apple-Command Key.

Essentially, what I did was Map the MAC Command key to the Control Key. My reasoning was that I wanted to preserve common Ctrl-Key sequences that MAC maps to Command-Key Sequences (i.e. Ctrl-F, for find). Also, I needed to preserve the true Control sequences, such as Ctrl-C for SIGINT. Basically we're multiplexing the Control key some.

After installing Karabiner, I was not able to get Ctrl-c to send the unix (SIGINT) initially. However, once I modified the private.xml, I got that working.

Steps:

  1. Download the Karabiner .dmg file from: https://pqrs.org/osx/karabiner/
  2. Double-click the .dmg file to install it.
  3. Once Karabiner is installed, bring up the key mappings.
    3.1 DO NOT map the either Command_L or Command_R to anything. Leave them unchecked.
    3.2 Map the Control_L & Control_R to the respective Command_L & Command_R.
  4. Next, edit the private.xml file. Helpful link: https://pqrs.org/osx/karabiner/document.html#privatexml
    4.1 Add the following snippet:

    <item>
         <name>MAC2Unix Hacks</name>
         <identifier>private.app_terminal_command2_to_ctrl</identifier>
         <appendix>Map Command+C to Ctrl+C For Terminal</appendix>
         <only>TERMINAL</only>
         <autogen>__KeyToKey__ KeyCode::C, VK_COMMAND, KeyCode::C, VK_CONTROL</autogen>     
    </item>
    
  5. Hit the reload button, and you should be good.
  6. Please note that in the Terminal window, if you want to copy/paste text, you will select it with the mouse or whatever. However, to now copy it to clipboard, you will need to use rt-click->copy from the mouse. Remember, we remapped Ctrl-C (which used to be "copy"), and is now SIGINT.
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.