involving the Return key in a System Preferences keyboard shortcut

Solution 1:

Does anyone know a way to work around that?

  • Second place would be doing it using config files somewhere on the filesystem.

In macOS Catalina, it's the ~Library/Preferences/pbs.plist file that stores information about the services listed at: System Preferences > Keyboard > Shortcuts > Services

This answer is mainly focused on applying the ⌘↩ (commandreturn) keyboard shortcut to a service listed at System Preferences > Keyboard > Shortcuts > Services and without concern to the issues with creating an Automator Service/Quick Action and assigning it a global keyboard shortcut in reference to System Preferences > Security & Privacy > Privacy.

Having created an Automator Service/Quick Action and assigned it a temporary global keyboard shortcut of ⌘] in System Preferences > Keyboard > Shortcuts > Services, I then did the following to change it to: ⌘↩

Note: The name of the target Automator Service/Quick Action is: New Terminal Window

Closed: System Preferences

Opened: Terminal

% defaults read pbs | grep 'New Terminal Window'
        "(null) - New Terminal Window - runWorkflowAsService" =         {
%
% /usr/libexec/PlistBuddy -c "set :NSServicesStatus:'(null) - New Terminal Window - runWorkflowAsService':key_equivalent @↩" ~/Library/Preferences/pbs.plist
% 

Then went to System Preferences > Keyboard > Shortcuts > Services and verified the target Automator Service/Quick Action had the ⌘↩ keyboard shortcut.

I then pressed the ⌘↩ keyboard shortcut, responded to the Security & Privacy dialog box, and now have a new Terminal window.


Notes:

If after running the PlistBudy command and then checking System Preferences > Keyboard > Shortcuts > Services to see that ⌘↩ was assigned to the target service's keyboard shortcut and testing... If the ⌘↩ keyboard shortcut doesn't work, try the following before rebooting:

  • Try the the service from the Services menu, then try agin with the ⌘↩ keyboard shortcut.
  • If that does't work, execute the PlistBudy command again while appending ; killall cfprefsd to the command. Then repeat the step above.
  • If nether of these steps work, execute the PlistBudy command again and immediately reboot.

This was done from an Admin account.

This was done under macOS Catalina with Language & Region settings in System Preferences set to English (US) — Primary and worked for me without issue1.

  • 1 Assumes necessary and appropriate setting in System Preferences > Security & Privacy > Privacy have been set/addressed as needed.

The AppleScript code used in a Run AppleScript action of the Automator Service/Quick Action was coded to work whether or not Terminal was already running.


enter image description here