Skip to content

Instantly share code, notes, and snippets.

@xvrdm
Forked from alexander-clark/init.lua
Last active September 28, 2022 08:54
Show Gist options
  • Save xvrdm/cb7ca9fe68eb568c90aceca22aa228e3 to your computer and use it in GitHub Desktop.
Save xvrdm/cb7ca9fe68eb568c90aceca22aa228e3 to your computer and use it in GitHub Desktop.
Hammerspoon - switch Mac Input Source / keyboard layout on Kinesis Advantage connect / disconnect
usbWatcher = nil
function usbDeviceCallback(data)
if (data["productName"] == "Kinesis Keyboard Hub") then
if (data["eventType"] == "added") then
hs.keycodes.setLayout("U.S. International - PC")
elseif (data["eventType"] == "removed") then
hs.keycodes.setLayout("Swiss French")
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