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.
To make this work you have to use a third party tool: Karabiner.
In the example below hitting the left alt key once generates one back command in Safari (only). An additional mouse click is not needed.
You can use the left option/alt key as usual otherwise.
- Download, install and open Karabiner
- Open in the menulet Karabiner -> Preferences
- Open the tab Misc & Uninstall
- Hit the button Open private.xml
- Open the file private.xml with an appropriate editor
Enter the customized keycode
<?xml version="1.0"?>
<root>
<item>
<name>Option_L to Option_L</name>
<appendix>(+ When you type Option_L only without other modifiers, send Command+[ in Safari)</appendix>
<identifier>remap.altL2altL_backward_nomod</identifier>
<only>SAFARI</only>
<autogen>__KeyOverlaidModifier__ KeyCode::OPTION_L, KeyCode::OPTION_L, KeyCode::BRACKET_LEFT, ModifierFlag::COMMAND_R</autogen>
</item>
</root>
Save the file
- Open in the menulet Karabiner -> Preferences the tab Change Key
- Hit the ReloadXML button
- Enable the remapping. It should be listed at the beginning.
If you want to use the right option/alt key instead of the left one just replace OPTION_L by OPTION_R and altL by altR everywhere in the private.xml file.
The above keycode customization is only valid for the en_US input source (and probably en_GB, en_CA etc).
If you use e.g the portuguese input source (pt_PT) then you have to choose the proper KeyCodes: to get the [ you have to press alt7. Then the line:
<autogen>__KeyOverlaidModifier__ KeyCode::OPTION_L, KeyCode::OPTION_L, KeyCode::BRACKET_LEFT, ModifierFlag::COMMAND_R
has to be changed to:
<autogen>__KeyOverlaidModifier__ KeyCode::OPTION_L, KeyCode::OPTION_L, KeyCode::KEY_7, ModifierFlag::OPTION_R | ModifierFlag::COMMAND_R
If you want to add a second custom keycode (hitting left cmd key once generates one forward command) use:
<?xml version="1.0"?>
<root>
<item>
<name>Option_L to Option_L</name>
<appendix>(+ When you type Option_L only without other modifiers, send Command+[ in Safari)</appendix>
<identifier>remap.altL2altL_backward_nomod</identifier>
<only>SAFARI</only>
<autogen>__KeyOverlaidModifier__ KeyCode::OPTION_L, KeyCode::OPTION_L, KeyCode::BRACKET_LEFT, ModifierFlag::COMMAND_R</autogen>
</item>
<item>
<name>Command_L to Command_L</name>
<appendix>(+ When you type Command_L only without other modifiers, send Command+] in Safari)</appendix>
<identifier>remap.cmdL2cmdR_forward_nomod</identifier>
<only>SAFARI</only>
<autogen>__KeyOverlaidModifier__ KeyCode::COMMAND_L, KeyCode::VK_LAZY_COMMAND_L, KeyCode::BRACKET_RIGHT, ModifierFlag::COMMAND_R</autogen>
</item>
</root>
The special KeyCode VK_LAZY_COMMAND_L instead of COMMAND_L doesn't break the function of cmd_left+Some_key: so you can navigate forward in Safari and print the page with cmd_leftP without going forward once more!
Best Answer
You can add/change any Key Command from
System Prefs > Keyboard > Shortcuts > App Shortcuts
Click the + button then add the info you require. [Later removing any custom binding will revert the app to its default binding]