From 8f600b057c85f63bf0dabe9287f58a1f130e45ee Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 31 Jan 2023 20:52:03 +0100 Subject: keyboard_layout: Add Keychron check Add a check for another keyboard I'm using to have it switch keyboard layouts on connection and disconnection. --- keyboard_layout.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'keyboard_layout.lua') 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 -- cgit v1.2.3