Created
October 18, 2015 05:59
-
-
Save gabamnml/8bf6e00d34219caa9037 to your computer and use it in GitHub Desktop.
Hammerspon script to change 'default' profile with custom for USB Keyboard using Karabiner App
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
local usbWatcher = nil | |
function usbDeviceCallback(data) | |
if (data["productName"] == "USB Keyboard") then | |
if (data["eventType"] == "added") then | |
hs.execute('/Applications/Karabiner.app/Contents/Library/bin/karabiner select 1') | |
elseif (data["eventType"] == "removed") then | |
hs.execute('/Applications/Karabiner.app/Contents/Library/bin/karabiner select 0') | |
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