Skip to content

marvell/raycast-input-source-switcher

Repository files navigation

Input Source Switcher

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.

Features

  • 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.

Requirements

  • macOS
  • Raycast
  • Node.js and npm for local development
  • Xcode Command Line Tools for rebuilding the Swift helper

Install Locally

git clone https://github.com/marvell/raycast-input-source-switcher.git
cd raycast-input-source-switcher
npm install
npm run build-helper
npm run dev

In 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 ID
  • Secondary Input Source ID
  • Show success HUD, usually disabled for fast hotkey switching

Commands

  • Set Primary Input Source
  • Set Secondary Input Source
  • Toggle Input Source
  • Show Current Input Source
  • List Input Sources

Hotkeys

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.

Native Helper

The bundled helper lives at:

assets/bin/input-source

Rebuild it with:

npm run build-helper

Helper 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> --quiet

Development

npm install
npm run build-helper
npm run lint
npm run build

Run all local checks:

npm run check

Smoke-test the helper:

npm run test-helper

Notes

Input 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.

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors