Command reference
Input Switch
Input Switch makes the keyboard layout follow the app, like Windows does. It remembers the input source (a keyboard layout, an input method or one of its modes) last used in each app and switches back to it when that app comes to the front. Fixed rules pin a layout to an app, a default covers apps with neither a rule nor a memory, and apps left alone are never switched. It works with every input source enabled in Keyboard settings, including Indian scripts such as Devanagari, Tamil or Hindi transliteration.
It has no command group of its own. Every action is an operation on the running
extension through ed invoke, with a JSON payload and a
JSON result on stdout. A refused request prints a JSON error on stderr and exits
non-zero, as described in conventions.
| Operation | Payload | What it does |
|---|---|---|
status |
{} |
Lists input sources, apps, rules, memories, favorites and the last switch. |
enable |
{} |
Turns switching on and applies the app in front. |
disable |
{} |
Turns switching off. Layouts stay as they are. |
select |
{"source": "..."} |
Switches to an input source now and remembers it for the app in front. |
cycle |
{} |
Switches to the next favorite, or the next enabled source without favorites. |
resolve |
{"app": "..."} |
Explains what would happen for an app, without switching. |
setMode |
{"app": "...", "mode": "remember", "source": "..."} |
Sets an app to remember, fixed or leaveAlone. source is optional for fixed. |
setRule |
{"app": "...", "source": "..."} |
Pins an input source to an app. |
clearRule |
{"app": "..."} |
Removes an app's fixed input source. |
exclude |
{"app": "..."} |
Leaves an app alone. |
include |
{"app": "..."} |
Stops leaving an app alone. |
forget |
{"app": "..."} or {"all": true, "confirm": true} |
Removes one app from the list, or forgets every remembered layout. |
setDefault |
{"source": "..."} or {"source": null} |
Sets or clears the layout for apps with no rule or memory. |
favorite |
{"source": "...", "favorite": true} |
Adds or removes a favorite. |
setFavorites |
{"sources": ["...", "..."]} |
Replaces the favorites, in cycle order. |
moveFavorite |
{"source": "...", "offset": -1} |
Moves a favorite earlier or later in the cycle. |
ed invoke inputSwitch statused invoke inputSwitch enableed invoke inputSwitch setRule --json '{"app":"com.apple.Terminal","source":"com.apple.keylayout.US"}'ed invoke inputSwitch setRule --json '{"app":"net.whatsapp.WhatsApp","source":"com.apple.keylayout.Devanagari-QWERTY"}'ed invoke inputSwitch exclude --json '{"app":"com.example.game"}'ed invoke inputSwitch setDefault --json '{"source":"com.apple.keylayout.US"}'ed invoke inputSwitch setFavorites --json '{"sources":["com.apple.keylayout.US","com.apple.keylayout.Devanagari-QWERTY"]}'ed invoke inputSwitch cycleed invoke inputSwitch resolve --json '{"app":"com.apple.Terminal"}'ed invoke inputSwitch forget --json '{"all":true,"confirm":true}'Apps are named by bundle identifier and input sources by the identifier macOS
gives them, which status lists under sources. A rule, default or favorite
must name a source that is enabled in Keyboard settings. Unknown keys and values
of the wrong type are rejected, and payloads are limited to 16 KiB. Every
operation except resolve returns the same document as status.
How an app's layout is chosen
When an app comes to the front, Input Switch waits for the delay set in its settings (150 ms unless changed), so apps you only pass through while switching quickly are skipped. Then, for the app in front:
- An app left alone is never switched.
- A fixed rule wins.
- Otherwise the layout last used in the app, when remembering is on.
- Otherwise the default layout.
- Otherwise the current layout stays.
A choice whose input source is no longer enabled is skipped and the next one is used. Remembering happens when you change layout yourself in an app; switches Input Switch makes itself, and changes while a switch is pending, are not remembered. Apps with a fixed rule or left alone are never remembered.
status
{ "apps": [ { "bundleID": "com.example.synthetic.chat", "learned": "com.apple.keylayout.Devanagari-QWERTY", "mode": "remember", "name": "Synthetic Chat", "running": true }, { "bundleID": "com.example.synthetic.terminal", "mode": "fixed", "name": "Synthetic Terminal", "rule": "com.apple.keylayout.US", "running": true } ], "currentID": "com.apple.keylayout.US", "delay": 150, "enabled": true, "favorites": ["com.apple.keylayout.US", "com.apple.keylayout.Devanagari-QWERTY"], "frontmost": { "bundleID": "com.example.synthetic.terminal", "name": "Synthetic Terminal" }, "learn": true, "lastSwitch": { "appName": "Synthetic Terminal", "at": "2026-11-29T10:00:00Z", "bundleID": "com.example.synthetic.terminal", "reason": "rule", "source": "com.apple.keylayout.US", "sourceName": "U.S." }, "perDocumentSwitching": false, "running": [ { "bundleID": "com.example.synthetic.chat", "name": "Synthetic Chat" }, { "bundleID": "com.example.synthetic.terminal", "name": "Synthetic Terminal" } ], "showHUD": true, "sources": [ { "current": true, "favorite": true, "id": "com.apple.keylayout.US", "isDefault": false, "kind": "layout", "label": "EN", "languages": ["en"], "name": "U.S." }, { "current": false, "favorite": true, "id": "com.apple.keylayout.Devanagari-QWERTY", "isDefault": false, "kind": "layout", "label": "HI", "languages": ["hi"], "name": "Hindi - QWERTY" } ], "synthetic": false}kind is layout, inputMethod or inputMode. perDocumentSwitching is true
when macOS is also set to switch to a document's input source, which fights
with Input Switch; turn that off in Keyboard settings, under Input Sources.
resolve
{ "bundleID": "com.apple.Terminal", "reason": "rule", "skipped": [], "source": "com.apple.keylayout.US"}reason is rule, learned, defaultSource, excluded, noPreference,
alreadyActive or unavailable. skipped lists the choices passed over
because their input source is not enabled.
Errors
Errors are JSON on stderr, for example
{"error":{"code":"unknownSource","message":"No enabled input source has the id com.example.missing. Add it in Keyboard settings first."}}.
Codes are invalidInput, unknownOperation, unknownSource, invalidApp,
noSources, selectFailed, limit and confirmationRequired.
Shortcut and settings
The Next layout shortcut (Control-Option-Command-I unless changed) runs cycle
and shows the new layout on screen. It works even while switching is off. The
settings sheet holds whether layouts are remembered, the delay before switching
and the on-screen label. Input Switch needs no permissions, and nothing leaves
the Mac.