Questions

Per-app keyboard shortcuts on a Mac

There are two versions of this wish. One is changing the shortcut for a menu command in one app, which macOS does on its own. The other is having the same key do a different job depending on the app in front: F13 cuts a clip in Final Cut Pro, reopens a tab in Safari, and opens Mission Control everywhere else. That second one is what InputConfig, the free app I make, does with presets that switch themselves as you change apps.

Change a menu shortcut in one app, with macOS

  1. Open System Settings, Keyboard, Keyboard Shortcuts, then App Shortcuts.
  2. Press the plus button and choose the app, or All Applications.
  3. Type the menu command's name exactly as it appears in the menu, including any trailing three dots.
  4. Press the shortcut you want and choose Done.

This only reaches commands that are in a menu, and the key has to be a combination the app does not already use. For anything else, such as opening another app, a macro, typed text or media keys, you need an app.

The same key, a different job in each app

In InputConfig a preset is a set of keys and what they do, and a preset can name the apps it belongs to. Only one preset runs at a time. With automatic switching on, the app in front decides which one:

KeyEverywhere presetFinal Cut Pro presetSafari preset
F13Mission ControlB (Blade)Shift Command T (reopen closed tab)
F14SpotlightM (add marker)Shift Command backslash (show all tabs)
F15Play / PausePlay / PausePlay / Pause

When you leave Final Cut Pro for an app with no preset of its own, the preset you had before comes back, so the Everywhere preset works as the fallback.

Download InputConfig on the Mac App StoreInputConfig is free on the Mac App Store. macOS 14 or later, no account, no tracking, open source.

Set it up

  1. Install InputConfig and allow Accessibility access.
  2. In Settings, Advanced, turn on Switch presets when the front app changes. It is off until you do.
  3. Build the Everywhere preset: add rows, press Scan, press each key, and pick its output. Activate it.
  4. Right-click it in the sidebar, choose Duplicate, and rename the copy after the app.
  5. In the copy, change the rows that should differ. Keep the rows you want everywhere, because only one preset runs at a time.
  6. Open Automation & Gaming Utilities in the copy, find Activate when these apps are in front, press plus and add the app.

If two presets list the same app, the first in sidebar order wins. Picking a preset by hand while you are in the app turns off the automatic return for that visit, so the switch never fights your choice.

Which keys to use

InputConfig listens alongside macOS, so a key keeps its own job too. That makes letters a poor choice and spare keys a good one: F13 to F19, a held right-hand modifier, mouse side buttons, a MIDI pad, or a game controller. Each row can also have a hold and a double-tap action, so one key can carry three jobs per app.

Other tools that do this

Karabiner-Elements can limit a key-to-key rule to certain apps with its frontmost application conditions, written as rules. BetterTouchTool and Keyboard Maestro, both paid, have per-app triggers and macro groups with a visual editor. If you need a key to stop doing its own job inside one app, those are the tools, because InputConfig adds to keys and never removes their job.

Questions

Can I have different keyboard shortcuts for different apps on a Mac?

Yes. For menu commands, System Settings, Keyboard, Keyboard Shortcuts, App Shortcuts sets a shortcut per app. For giving the same spare key a different job in each app, InputConfig presets switch themselves when the app comes to the front.

What happens when I switch to an app that has no preset?

The preset that was running before the automatic switch comes back. If nothing was running, InputConfig stops until you go back to an app that has one.

Does it work in full-screen apps and games?

Yes. The switch happens when the app becomes the front app, full screen or not.

Can I switch keyboard layouts per app?

That is a typing setting, not a shortcut. Look in System Settings, Keyboard, Text Input, Input Sources, where macOS can switch to a document's input source automatically.

Can one preset cover several apps?

Yes. Add as many apps as you like to one preset, for example Safari, Chrome and Firefox on one browser layout.

Related

Download InputConfig on the Mac App StoreFree. macOS 14 or later. No account, nothing leaves your Mac. Open source on GitHub.