keyboardSwitcher is a command-line tool designed for macOS that allows you to list, show, and switch between different keyboard layouts effortlessly.
- list: List all available keyboard layouts.
- enabled: List enabled layouts (those configured in System Preferences).
- select "<layout>: Set the current keyboard layout.
- get: Retrieve the currently active keyboard layout.
- version: Print the version of
keyboardSwitcher. - enable "<layout>: Enable a layout so it can then be selected.
- disable "<layout>: Disable a layout so it can no longer be selected.
To successfully execute the select command, the desired keyboard layout must first be enabled.
This can be achieved by:
- adding the layout in the macOS Settings app under Keyboard > Sources.
OR
- using the
enablecommand
Many users find keyboardSwitcher beneficial in conjunction with third-party tools such as KeyboardMaestro or via Alfred workflows. For example, you can dynamically switch the keyboard layout based on the connection status of a Bluetooth keyboard or use an Alfred workflow for quick layout changes.
Using Homebrew:
brew install lutzifer/homebrew-tap/keyboardSwitcherUsing Mint:
mint install lutzifer/keyboardSwitcherDownload the Alfred workflow from the releases page and use commands like "eng" and "ger" to swiftly change the keyboard layout.
keyboardSwitcher listOutput:
Available Layouts:
2-Set Korean
3-Set Korean
390 Sebulshik
Afghan Dari
Afghan Pashto
Afghan Uzbek
Anjal
(…)
keyboardSwitcher enabledOutput:
Enabled Layouts:
Colemak
Turkish - QWERTY PC
U.S.
keyboardSwitcher select "German"
keyboardSwitcher getOutput:
German
keyboardSwitcher select "U.S."
keyboardSwitcher getOutput:
U.S.
enable British-PC
Output:
Enabling "British-PC"...
FOUND by shortened input source id
Successfully enabled the layout "British – PC".
select British-PC
Output:
Selecting "British-PC"...
FOUND by shortened input source id
Successfully set the layout "British – PC".
NOTE: Layouts can be referenced in three different ways. This can be convenient as some keyboard layout localised names contain non-ASCII characters such as the en dash (–).
- Fully qualified input source id e.g.
com.apple.keylayout.British-PC- Shortened input source id e.g.
British-PC- Localised name
"British – PC"
disable com.apple.keylayout.British-PC
Output:
Disabling "com.apple.keylayout.British-PC"...
FOUND by fully qualified input source id
Successfully disabled the layout "British – PC".
Feel free to explore the various commands to manage your keyboard layouts efficiently.