Yonatan Ben Knaan

Shortcuts on macOS


Posted Sep 2020

Updated Feb 2024


How to create, edit or remove shortcuts for a macOS

Screen shot of Mac keyboard shortcuts page on Apple support

The macOS and its apps comes packed with sweet and effective commands like the awesome Merge All Windows that helps you declutter your desktop 👌

But not all is good, you can easily find yourself doing the same task, navigating and clicking items over and over again, in menus unfitting to Fitts’s Law.

This can lead to frustration, and even worse – not executing the command because you where too damn lazy navigating them damn menus.

The Merge All Windows command in action triggered manually from the menuThe Merge All Windows command in action triggered manually from the menu ☝️

How will this article help you?

If you don't know how to create shortcuts for mac, with this article will you'll learn:

  1. How to set up shortcuts on the macOS
  2. How to create shortcuts for a specific app
  3. How to override exciting shortcuts
  4. Some advance shortcut methods

The two examples

Here are two use cases where custom shortcuts will improve your workflow:

  1. Merge All Windows
    This command is relevant for all apps that are multi window: Let's say you find yourself with 7 open Sketch files and 6 Finder windows, and you're clicking like crazy trying to find the window you're looking for. What an hassle.
    The Merge All Window command is a great cleaner upper and I use it all over the place – It will merge all of your open windows into one window to be shown as tabs.
    Image of the Merge All Windows command in actionThe Merge All Windows command in action ☝️
  2. Collapse All Groups
    This command is app specific, this case Sketch App (and I also find myself do it a lot in VS Code) and it deals with viewing the side panel on a big file or project. Of course you can scroll or close groups and layers manually, but sometimes you'd like the get an overview at a glance. That's where this command comes in handy 🤲
    Image of the Collapse All Groups command in actionThe Collapse All Groups command in action ☝️

Now let's learn how solve these problems and have a better workflow 🎉

Merge All Windows – a custom macOS shortcut

  1. Open the Keyboard preferences in the System Settings. You can use the macOS Spotlight search by clicking control spacebar (a great shortcut by itself) and start typing what your looking for. We're looking for the Keyboard preferences, so I'll start typing key, then I'll see it as an option, click it! BTW, I'm using Raycast instead of the default Spotlight search.
    Raycast search in actionRaycast search in action ☝️
    You can also just look for it in the System Preferences, found in the Apple menu.
    The Apple menu - You can fine the preferences menu hereThe Apple menu - You can fine the preferences menu here
  2. In the Keyboard pane click the Keyboard Shortcuts… button.
    The Keyboard pane on the System Settings, showing the Keyboard Shortcuts… buttonThe Keyboard pane on the System Settings, showing the Keyboard Shortcuts… button
  3. This will open a new window, in it select the App Shortcut tab. At the bottom of the right panel you'll see + and - buttons. Clicking the + button will open a prompt window.
    macOS Keyboard Shortcut ManagermacOS Keyboard Shortcut Manager
  4. In the prompt window you'll see a few inputs. In the first input, Application, leave the default option All Applications as is. In the Menu Title input, type in the Merge all window command. And lastly type the shortcut you want to init the command into the Keyboard Shortcut input by hitting the actual shortcut you wanna use.
    For this shortcut I'll use the ctrl option cmd m combination by typing them while in the input.
    macOS Keyboard Shortcut ManagermacOS Keyboard Shortcut Manager

    Keep in mind!

    Shortcut is a combination of modifier keys and a character key.

    Just making sure where on the same page – Modifier keys change the normal behavior of a key, like turing a 1 into a !.

    The available modifiers are; ctrl, option, cmd & shift. Regular keys are the rest of them; A to Z, 1 to 0 and some special characters -+[]\;§,./.

    You have to type the command name verbatim – exactly as it appears in the app's menu – capital letters and spacing.

  5. Click Add button and there you have it! You've just created a costume shortcut for macOS 🧨

Nice! now you can warp scatted windows like a boss and eliminate that document mess you call a desktop 🧹

Collapse All Groups – Custom shortcut for Sketch

For the Collapse All Groups command just repeat the previous flow with an exception on item number 4, which is: Pick Sketch at the Application dropdown.

Make the shortcut specific by selecting an appMake the shortcut specific by selecting an app

Obviously you'll need to type in the relevant command name and shortcut combination (I'm using ctrl option cmd c), but other then that the 2 use cases are the same.

Once you've clicked Add you can get back to sketch and use this short cut to make your panel views look tidy and hospitable 🤓


Pro tips

There are shitloads of commands and obviously you won't use them all as shortcuts. But there are still better ways to look them up other then going through the menus. So here are some handy wildcard shortcuts you can use instead.

The Help Menu

Most apps on the macOS has the Help Menu which allows to fussy search for you command just by typing it. Just click command shift / and the search will be waiting for a quick search 🏃

Look for a command using the Help MenuLook for a command using the Help Menu

Using Sketch Runner

You can also locate and run commands (and much more) in Sketch using a plugin called SketchRunner. It's a good one and it does a lot – it Inserts symbols, Goes to pages, artboards or symbols, Creates symbols or styles, Applies styles and Installs plugins — but for the sake of this article — it runs commands (just like the Help Menu) but with a nicer UI and while showing your latest actions.

This is the Sketch Runner modal window to Run commandsThis is the Sketch Runner modal window to Run commands

Resolving Identical Commands Conflicts

Shortcuts in mac need to be unique. Let's take for example the Align Left commands in Affinity Photo, if you'll ever create a shortcut for it, it won't work. The reason is, this command ain't unique – you can find the same commands both under the Text and the Arrange menu items. The app won't know which Align Left you're referring to, so it might keep the default or have no affect at all 😒

To resolve it you'll need to make the command unique, and the way to do it is by adding its exact path. Here's the path for these two commands:

  • Text → Alignment → Align Centre
  • Arrange → Align Centre

As seen in the image below 👇

The two Align Left commandsThe two Align Left commands ☝️

So is you want the Arrange's Align Left command, you should type it like that Arrange->Align Left

The resolved two Align commands in the shortcuts menuThe resolved two Align commands in the shortcuts menu ☝️

There you have it, a command the is unique as a snowflake ❄️

Well, that's all for today!

See you in the next post 👋