aboutsummaryrefslogtreecommitdiffstats
path: root/keyboard_layout.lua
diff options
context:
space:
mode:
authorTeddy Wing2023-01-31 20:52:03 +0100
committerTeddy Wing2023-01-31 20:52:03 +0100
commit8f600b057c85f63bf0dabe9287f58a1f130e45ee (patch)
tree67cdf970204535add0d6a665390817584282dc5d /keyboard_layout.lua
parent2e2cbb6296d2022d588a21fdefe3900015d17ea1 (diff)
downloaddothammerspoon-8f600b057c85f63bf0dabe9287f58a1f130e45ee.tar.bz2
keyboard_layout: Add Keychron check
Add a check for another keyboard I'm using to have it switch keyboard layouts on connection and disconnection.
Diffstat (limited to 'keyboard_layout.lua')
-rw-r--r--keyboard_layout.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/keyboard_layout.lua b/keyboard_layout.lua
index 26a38af..8a62be3 100644
--- a/keyboard_layout.lua
+++ b/keyboard_layout.lua
@@ -23,6 +23,12 @@ local function is_imate(event)
and event['productID'] == 1029
end
+local function is_keychron(event)
+ return event['productName'] == 'Keychron C2'
+ and event['vendorID'] == 1452
+ and event['productID'] == 591
+end
+
local function is_generic_keyboard(event)
local product_name_contains_word_keyboard = string.find(
string.lower(event['productName']),
@@ -34,6 +40,7 @@ end
keyboard_usb_watcher = hs.usb.watcher.new(function(event)
if not is_imate(event)
+ and not is_keychron(event)
and not is_generic_keyboard(event)
then
return