Raycast extension for switching macOS keyboard input sources directly from Raycast commands.
The main workflow is assigning independent Raycast hotkeys to specific input sources, for example:
- Left Command -> English input source
- Right Command -> Russian input source
Raycast owns hotkey capture. The extension only runs the selected command and switches the active macOS input source through a small native Swift helper that uses the Text Input Sources API.
- Switch to a configured primary input source.
- Switch to a configured secondary input source.
- Toggle between primary and secondary input sources.
- Show the current input source.
- List available input sources and copy exact IDs.
- Optional success HUD for switching commands.
- No keyboard event tap, Accessibility permission, Input Monitoring permission, or simulated keypresses.
- macOS
- Raycast
- Node.js and npm for local development
- Xcode Command Line Tools for rebuilding the Swift helper
git clone https://github.com/marvell/raycast-input-source-switcher.git
cd raycast-input-source-switcher
npm install
npm run build-helper
npm run devIn Raycast, run List Input Sources and copy the IDs you want to use.
Common examples:
com.apple.keylayout.ABC
com.apple.keylayout.Russian
com.apple.keylayout.RussianWin
Then open the extension preferences in Raycast and set:
Primary Input Source IDSecondary Input Source IDShow success HUD, usually disabled for fast hotkey switching
Set Primary Input SourceSet Secondary Input SourceToggle Input SourceShow Current Input SourceList Input Sources
Assign hotkeys in Raycast settings to the commands you need. Raycast 2 can record left/right modifier hotkeys at the application level, so you can bind:
- Left Command ->
Set Primary Input Source - Right Command ->
Set Secondary Input Source
The extension does not distinguish left/right modifiers itself.
The bundled helper lives at:
assets/bin/input-source
Rebuild it with:
npm run build-helperHelper CLI:
assets/bin/input-source list
assets/bin/input-source current
assets/bin/input-source select <input-source-id>
assets/bin/input-source select <input-source-id> --quietnpm install
npm run build-helper
npm run lint
npm run buildRun all local checks:
npm run checkSmoke-test the helper:
npm run test-helperInput source IDs vary by installed macOS layouts. Use List Input Sources instead of hardcoding IDs from examples.
The hot path uses the helper's quiet mode and does not show a HUD unless enabled in preferences.
MIT