Add Shortcuts to Automator
To create a shortcut on macOS that open and runs something in the terminal, you can use Automator along with System Preferences > Keyboard > Shortcuts. Here's how to achieve this:
Step 1: Create an Automator Workflow
- Open Automator (Search for it using Spotlight or find it in Applications).
- Select Quick Action as the document type.
- Set the following options at the top of the workflow:
- Workflow receives: "no input" in "any application."
- Search for Run AppleScript in the left sidebar and drag it into the workflow area.
- Paste the following AppleScript:
tell application "Terminal"
activate
do script "echo hi" in front window
end tell
- Save the workflow with a descriptive name like
some-name
.
Step 2: Assign a Keyboard Shortcut
- Go to System Preferences > Keyboard > Shortcuts.
- Select Services in the left-hand menu.
- Scroll down to find the service you just created (likely under "General" or a custom section).
- Click on it and assign a keyboard shortcut by pressing a combination like
Command + Shift + T
(or another unused shortcut).