82

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.

xdumaine
  • 2,299
  • 4
  • 22
  • 35
Greg R.
  • 1,834
  • 3
  • 17
  • 17
  • 1
    Eh, well darn. 10 minutes after submitting the question, I found the answer myself. A program called [KeyRemap4MacBook](http://pqrs.org/macosx/keyremap4macbook/index.html) 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 08:53
  • dmiandre, I didn't because I don't have any need to switch languages. Sorry. – Greg R. Sep 29 '16 at 15:32
  • Remapping "Left cmd" to "Left ctrl" in Karabiner Elements macOS app can be an option. Here is my remapping rule `{"title":"MS Remote Desktop","rules":[{"description":"MS Remote Desktop - Left cmd to Left ctrl","manipulators":[{"type":"basic","from":{"key_code":"left_gui"},"conditions":[{"type":"frontmost_application_if","bundle_identifiers":["com.microsoft.rdc.macos"]}],"to":[{"repeat":true,"key_code":"left_control"}]}]}]}` – Vlad Apr 07 '23 at 20:48

4 Answers4

64

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.

Yahor
  • 153
  • 1
  • 5
Greg R.
  • 1,834
  • 3
  • 17
  • 17
  • 1
    Omg, thank you so much. [Here are my settings](https://gist.github.com/DanSkeel/2a98f54cc672bed3cb3b) 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 09 '16 at 22:04
  • 14
    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 06 '18 at 02: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](https://gist.github.com/alexkb/8c8ad2f4acc336083ab111c1ed695be9) if anyone needs it. Thanks! – alexkb Apr 22 '20 at 07: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 02 '20 at 07:40
  • Wow.. Been years dealing with this issue.. I'd rather have Ctrl-C always be Ctrl-C as I grew up on Windows.. this is a godsend.. thanks! – Tim Davis Jan 18 '21 at 15:09
  • This solution seems to disable local commands using Ctrl or Cmd, such as Cmd-Space for spotlight (which is now mapped to Ctrl-space, but only when the remote desktop app is frontmost, and even when there's no remote session open) or ctrl-leftarrow and ctrl-rightarrow for changing Space, which appear to now be totally disabled when the remote desktop app is frontmost. Is there a way to map it so it only sends the remapping to the remote session, without taking over those keys globally for the local session depending on what app is frontmost? – John Smith Dec 06 '21 at 04:08
30

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
  • 1,628
  • 1
  • 22
  • 27
  • 1
    "the Resources/Keyboard directory within the application contents"... where? – Chris Nov 04 '16 at 09: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 09:02
  • 2
    Also, dont mistake "Microsoft Remote Desktop **Beta**" for just "Microsoft Remote Desktop" as I did. – Dmitry Yantsen Nov 21 '16 at 09: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 08:04
  • 1
    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 06 '16 at 21:03
  • 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 Dec 10 '16 at 21:36
  • hockeyapp.net is owned by Microsoft. The ASN on the whois of the domain is Microsoft: http://whois.domaintools.com/hockeyapp.net – Mike Kormendy Mar 30 '17 at 18:19
  • 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 Apr 22 '17 at 23:07
  • `Applications > Microsoft Remote Desktop Beta.app` Show Package `Contents > Resources > Keyboard > ClipboardActionTransformations.xml` – Brian D Jul 24 '17 at 17:49
  • 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 Feb 09 '18 at 01:23
  • Is there documentation for these xml files anywhere? I'm looking to map complex things like Command+Q -> Alt-F4, etc. – Albert Bori Mar 23 '18 at 01:04
  • Can I simply remap CTRL to Cmd for ALL shortcuts in `ClipboardActionTransformations.xml` ? – Sébastien Nov 27 '18 at 15:32
  • 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 Sep 21 '19 at 06:52
  • 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 Sep 21 '19 at 07:02
  • Awesome trick for the ClipboardActionTransformations.xml! Works for most shortcuts, but unfortunately not for Cmd+W (which still closes the whole browser instead of a single tab). – dbernard Mar 24 '20 at 14:04
  • Version 10 of Microsoft Remote Desktop now has this feature. Download the latest version from Mac App Store, and the preference "Use Mac shortcuts for copy, cut, paste, and select all" is in the General tab. https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-mac – spokeadoke Apr 27 '20 at 11:23
  • 1
    Checking this box doesn't seem to have any impact. Can anyone confirm this actually works for them? I'm running Big Sur – NSjonas Oct 15 '21 at 14:59
  • How to add "Command + Shift + F" to "Control + Shift + F" I am frequent user of this combination in jetbrain – Tousif Aug 29 '23 at 10:29
19

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.

  • 1
    Ugh, not currently compatible with sierra though... – user895861 Dec 06 '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 09 '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: https://forum.keyboardmaestro.com/t/switching-command-and-control-keys/7721/23 – Mau Jul 24 '18 at 01:00
2

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.
I say Reinstate Monica
  • 25,487
  • 19
  • 95
  • 131
eric
  • 21
  • 1