3 releases
Uses new Rust 2024
| 0.1.2 | Oct 12, 2025 |
|---|---|
| 0.1.1 | Oct 12, 2025 |
| 0.1.0 | Oct 12, 2025 |
#272 in Hardware support
27KB
624 lines
keyswitch
Lightweight keyboard layout switcher and shortcut manager for MacOS.
-
Switches keyboard layouts with a single keypress INSTANTLY
-
Written in Rust - small and fast
-
Optionally, allows to run custom commands with key combinations
Installation
Rustaceans
cargo install keyswitch
(you may still need a symlink to ~/.cargo/bin/keyswitch to see it in Finder
for Input Monitoring permission)
Non-Rustaceans
Download a pre-built binary from Releases section and place it e.g. to ~/bin.
Setup
-
Run
keyswitch setup -
All instructions are printed in the terminal, but just in case:
-
It will create a configuration file at
~/.config/keyswitch/config.toml -
Add the binary path in
System Preferences -> Privacy & Security -> Input Monitoring -
Use
keyswitch edit-configto open the configuration file in the default terminal editor. Or edit~/.config/keyswitch/config.toml manually -
To get key codes and modifiers, run
keyswitch sniff, important: the terminal app must also have Input Monitoring permission (at least until the setup is over) -
Start
keyswitchin the terminal to ensure it works -
Run
launchctl load /Users/gigabito/Library/LaunchAgents/ai.bma.keyswitch.plistto start it in background and have it started on login
Updating
-
Replace the binary
-
Remove and add again the Input Monitoring permission
Troubleshooting
-
Some keys do not report scan codes via
CGEventTap, useKarabiner Elementsto remap them to something weird and never exists, e.g.F19 -
Ensure there are no key combinations conflicting with other apps
If the app do not start at all
- add to
~/Library/LaunchAgents/ai.bma.keyswitch.plist:
<key>StandardOutPath</key>
<string>/tmp/keyswitch.out</string>
<key>StandardErrorPath</key>
<string>/tmp/keyswitch.err</string>
- Reload the LaunchAgent:
launchctl unload ~/Library/LaunchAgents/ai.bma.keyswitch.plist
launchctl load ~/Library/LaunchAgents/ai.bma.keyswitch.plist
- check
/tmp/keyswitch.outand/tmp/keyswitch.errfor errors
Dependencies
~11–25MB
~214K SLoC