Custom keyboard layout: Command+V doesn't paste in Safari and Mail I have created a custom keyboard layout (.keylayout file) and remapped (amongst other keys) the X, C and V keys. However, I want to keep Cmd+X/C/V like on the QWERTY, because it's practical and I am used to it.

So in my layout, I have kept the original X, C, V mappings for when Command is pressed:

&lt;keyMap index="0"&gt;  &lt;!-- No modifiers --&gt;
  ...
  &lt;key code="7" action="y" /&gt; &lt;!-- my modified layout --&gt;
  &lt;key code="8" action="x" /&gt;
  &lt;key code="9" action="." /&gt;
...
&lt;keyMap index="10"&gt;  &lt;!-- command --&gt;
  ...
  &lt;key code="7" output="x" /&gt; &lt;!-- same as qwerty --&gt;
  &lt;key code="8" output="c" /&gt;
  &lt;key code="9" output="v" /&gt;


This works well except for Command+. (which should do a Command+V, i.e. paste) in Safari, Mail and a few other Apple applications… In that case, using the original V key (on a QWERTY keyboard) does work…

I don't understand why it fails just for this shortcut? I've read that some Cmd+… shortcuts are special and can't be overridden, but why does it work with cut/copy but not with paste? And why does it work in all applications except Safari and Mail?



I've used the bepo (french dvorak) layout and edited it in a text editor. My version is on GitHub. I have opened my layout in Ukulele and it shows it quite fine, is there anything I could try with it to debug/detect problems?

I have also tried to open+save my layout with Ukulele and it doesn't work anymore, it's not even detected by OS X. I have reverted back to my version.
I'm not surprised you may be experiencing this issue with Apple Software. Basically the Command-. keyboard shortcut has been used by Mac OS for decades as a universal "halt operations" keyboard shortcut. 

In a sense it works in a similar way to the ESC key. So I am thinking this is why you are experiencing problems with this keyboard shortcut. It used to be that software developers had to respect this Command-. keyboard shortcut for any software they developed for the Mac platform, but this is no longer the case, hence why your keyboard shortcut may be working with some software but not others. You may want to read the Keyboard Shortcuts page in the macOS Human Interface Guidelines.

Extra Info

Apple first introduced the Command key in 1980 with the Apple III computer.

The purpose of the Command key was to allow users to enter keyboard commands in applications and within the operating system. The Macintosh Human Interface Guidelines have always recommended that developers use the Command key (and not the Control or Option keys) for this purpose. 

A small set of keyboard commands (such as cut and paste, open and save) are standard across all applications. If an application needs more shortcuts than can be obtained with the twenty-six letters of the English alphabet, double modifiers such as Command+Option are used.

The Macintosh keyboard's other unusual modifier key, the Option key, serves as a modifier both for entering keyboard shortcuts and for typing text — it is used to enter foreign characters, typographical symbols, and other special characters.

As mentioned previously, the Command-. shortcut was once a universal recommended shortcut, but this is no longer reserved by macOS. In fact, Table 67-3 of the macOS Human Interface Guidelines now only lists one keyboard shortcut with a period (.) in it. This is the Control-Option-Command-. keyboard shortcut for increasing screen contrast. You can read more about this in Accessibility Programming Guide for OS X.