How would I remap Mac CMD to CTRL keys in Remote Desktop Connection for Mac application?

59

21

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.

Greg R.

Posted 2011-03-28T18:54:48.720

Reputation: 1 404

How did you map cmd+space for switching languages? – dmiandre – 2016-09-28T08:53:27.030

dmiandre, I didn't because I don't have any need to switch languages. Sorry. – Greg R. – 2016-09-29T15:32:28.093

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. – 2011-03-28T19:08:59.120

Answers

45

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.

Greg R.

Posted 2011-03-28T18:54:48.720

Reputation: 1 404

1

Omg, thank you so much. Here are my settings for Karabiner to enable Shift+Enter shortcut for newline in Messages app.

– DanSkeel – 2015-06-19T15:19:35.133

2I'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 – 2016-12-09T22:04:04.977

3Go 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 – 2018-06-06T02:09:49.267

24

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".

davidcondrey

Posted 2011-03-28T18:54:48.720

Reputation: 1 345

1"the Resources/Keyboard directory within the application contents"... where? – Chris – 2016-11-04T09:32:01.220

2@Chris, it can be also be done in GUI: "Preferences" - "General". The checkbox "Use Mac shortcuts for Cut, Copy, and Paste" – Dmitry Yantsen – 2016-11-21T09:02:15.407

2Also, dont mistake "Microsoft Remote Desktop Beta" for just "Microsoft Remote Desktop" as I did. – Dmitry Yantsen – 2016-11-21T09:02:59.740

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 – 2016-11-22T08:04:15.110

Just edited this file as directed. Added support for L,T(chrome new tab ,W close), S-Save, D-(my delete line intellij). – user895861 – 2016-12-06T21:03:52.430

Can we get the BETA version directly from Microsoft? I can only find a link to download it from hockeyapp.net . Who is hockeyapp and why are they distributing it instead of Microsoft? – George Filippakos – 2016-12-10T21:36:53.093

hockeyapp.net is owned by Microsoft. The ASN on the whois of the domain is Microsoft: http://whois.domaintools.com/hockeyapp.net

– Mike Kormendy – 2017-03-30T18:19:36.657

hockey app is not owned by Microsoft. It's owned by HockeyApp. It's a site used to distribute Beta versions. If you have an official version then you can go to Help-> What's new in Beta and you get the above link. The app and release versions are genuine and the product is official Microsoft App. – Kunal Balani – 2017-04-22T23:07:49.390

Applications > Microsoft Remote Desktop Beta.app Show Package Contents > Resources > Keyboard > ClipboardActionTransformations.xml – Brian D – 2017-07-24T17:49:19.473

Now 2018, the version of Microsoft Remote Desktop is still on Version 8.0.43 (Build 27325) and doesn't have these functions.

UPDATE: just realise microsoft has 2 version of Remote Desktop in the Mac App store. Version 8 and Version 10. The version 10 should have this feature. – williamli – 2018-02-09T01:23:01.723

Is there documentation for these xml files anywhere? I'm looking to map complex things like Command+Q -> Alt-F4, etc. – Albert Bori – 2018-03-23T01:04:32.370

Can I simply remap CTRL to Cmd for ALL shortcuts in ClipboardActionTransformations.xml ? – Sébastien – 2018-11-27T15:32:59.383

Yeah, but on a Mac trying to use a GUI editor on Windows over RDP means simply mapping the cut/copy/paste keys is insufficient, since Windows is CTRL key centric. – clearlight – 2019-09-21T06:52:52.193

Yeah, but on a Mac trying to use a GUI editor on Windows over RDP means simply mapping the cut/copy/paste keys is insufficient, since Windows is CTRL key centric. Fortunately I was able to map ALL the command keys to CTRL keys in ClipboardActionTransformations.xml. That was a GREAT tip. Thanks so much. Real lifesaver. I – clearlight – 2019-09-21T07:02:24.067

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.

George Filippakos

Posted 2011-03-28T18:54:48.720

Reputation: 281

1Ugh, not currently compatible with sierra though... – user895861 – 2016-12-06T18:12:05.883

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 – 2016-12-09T22:05:05.720

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 – 2016-12-10T21:26:49.293

I successfully set up a keyboard map switch only in Teamviewer app. Which is great: https://forum.keyboardmaestro.com/t/switching-command-and-control-keys/7721/23

– Mau – 2018-07-24T01:00:00.400

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.

eric

Posted 2011-03-28T18:54:48.720

Reputation: 11