Last active
March 27, 2025 02:16
-
-
Save unnamed777/27fe64a1bed0ee9dc52ff84b434fc254 to your computer and use it in GitHub Desktop.
Hammerspoon: swap karabiner configs depending on language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Hammerspoon for karabiner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| rm ~/.karabiner.d/configuration/karabiner.json | |
| cp ~/.karabiner.d/configuration/en.json ~/.karabiner.d/configuration/karabiner.json | |
| killall karabiner_console_user_server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function plainInputSourceChange() | |
| -- hs.alert.show(hs.keycodes.currentLayout()) | |
| if (hs.keycodes.currentLayout() == "U.S.") then | |
| hs.execute("~/.karabiner.d/en.sh") | |
| elseif (hs.keycodes.currentLayout() == "Russian - PC") then | |
| hs.execute("~/.karabiner.d/ru.sh") | |
| end | |
| end | |
| hs.keycodes.inputSourceChanged(plainInputSourceChange) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| rm ~/.karabiner.d/configuration/karabiner.json | |
| cp ~/.karabiner.d/configuration/ru.json ~/.karabiner.d/configuration/karabiner.json | |
| killall karabiner_console_user_server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome workaround!