mac global hotkey

发布时间 2023-04-04 18:54:59作者: ploolq

https://www.computerhope.com/issues/ch002051.htm

In macOS, there are many ways to launch an application. You can click an icon in the Dock or the Launchpad, or type the name of the app in the Spotlight search box. However, in macOS, there is no built-in way to launch an application by pressing a keyboard shortcut.

Using the macOS Automator, you can create a custom service to launch the application of your choice, and bind a keyboard shortcut to it. When you press the keyboard shortcut, the chosen application launches automatically.

Follow the steps below to configure a keyboard shortcut to launch an application in macOS 10.15 Catalina.

Create an Automator service

First, create an Automator service to launch your app.

1

In the macOS Finder, open the Applications folder. Double-click Automator.

2

If this is the first time you are running Automator, your Automator documents open in a Finder window. Click the New Document button, or double-click the New Document icon.

3

Click the Quick Action document type, then click Choose.

In the Workflow receives current drop-down menu, select no input.

5

On the left is a list of Actions from your Actions Library. Scroll down to Launch Application. Drag this action from the list and drop it in the gray area of the window, as indicated.

6

The new action appears on the right, outlined in blue.

7

In the Launch Application drop-down menu, select the application you want to launch. If your app is not listed, choose "Other" to locate it manually. In this example, we have chosen the terminal application iTerm.

8

Configuration is complete. Open the File menu and choose Save.

9

Type a name for your quick action and click Save.

Close the Automator window.

10

Open the Apple menu and choose System Preferences.

11

Click Keyboard.

12

Click Shortcuts. On the left, click Services. Scroll down to the service you created, and click to select it. Click Add Shortcut.

13

A text box opens. Press the desired key combination for your shortcut. In this example, we've held down Command and pressed the backslash key .

You can choose any combination of Command, Shift, Option/Alt, and the alphanumeric keys. If your chosen shortcut conflicts with an existing shortcut, you will be alerted.

Choose a keyboard shortcut that you do not use in any other application. If you're running another application that uses the same shortcut, your custom shortcut will not work.

14

Close the System Preferences. When you press the key combination, your app launches. If your app is already running in the background when you press the shortcut, it comes to the foreground of your other applications.