Skip to content

Instantly share code, notes, and snippets.

@unnamed777
Last active September 26, 2017 05:35
Show Gist options
  • Save unnamed777/27fe64a1bed0ee9dc52ff84b434fc254 to your computer and use it in GitHub Desktop.
Save unnamed777/27fe64a1bed0ee9dc52ff84b434fc254 to your computer and use it in GitHub Desktop.
Hammerspoon: swap karabiner configs depending on language
Hammerspoon for karabiner
#!/bin/bash
rm ~/.karabiner.d/configuration/karabiner.json
cp ~/.karabiner.d/configuration/en.json ~/.karabiner.d/configuration/karabiner.json
killall karabiner_console_user_server
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)
#!/bin/bash
rm ~/.karabiner.d/configuration/karabiner.json
cp ~/.karabiner.d/configuration/ru.json ~/.karabiner.d/configuration/karabiner.json
killall karabiner_console_user_server
@aeternas
Copy link

Awesome workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment