How Do I Detect When an USB Keyboard Is Connected?

hello,

I duno how to detect an external usb keyboard is connected (via thunderbolts, USB concentrator, or directly)
I would like to change the input method to French - PC and when disconnected go back to French.

thanks for your help.

i'v got it

This USB device
with name containing : Dell KB216 Wired Keyboard
is attached

Will execute ... :
Set Keyboard Layout to "Français - PC"

and another action with
is detached

I think it's working but not really, it doesn't change the keyboard Layout ;( as i see in the logs :

2021-04-12 22:30:50 Execute macro “Set Keyboard Layout Français” from trigger USB Device with Name Containing “Dell KB216 Wired Keyboard” is Detached
2021-04-12 22:30:55 Execute macro “Set Keyboard Layout Français PC” from trigger USB Device with Name Containing “Dell KB216 Wired Keyboard” is Attached

i have tested both manual and it's ok

I haven't change anything, it's working now :wink:

Edit : the macro was on a special group...

To see the name of the device : in Terminal
ioreg -p IOUSB

(I'm on a MacBook Pro M1)

1 Like

This is the same problem I keep facing in my razer black widow lite and I have tried everything to resolve this but still unable to resolve it.