Created
October 2, 2017 20:56
-
-
Save alexander-clark/10c71d3299d387dee327c1c4b47f63c2 to your computer and use it in GitHub Desktop.
Hammerspoon - switch Mac Input Source / keyboard layout on Kinesis Advantage 2 connect / disconnect
This file contains 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
usbWatcher = nil | |
function usbDeviceCallback(data) | |
if (data["productName"] == "Advantage2 Keyboard") then | |
if (data["eventType"] == "added") then | |
hs.keycodes.setLayout("U.S.") | |
elseif (data["eventType"] == "removed") then | |
hs.keycodes.setLayout("Dvorak") | |
end | |
end | |
end | |
usbWatcher = hs.usb.watcher.new(usbDeviceCallback) | |
usbWatcher:start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment