Is there a way to execute a shell script whenever a HID device is connected either directly or over bluetooth?
Asked Answered
M

0

7

I'm taking advantage of macOS's hidutil command to perform custom key mappings, as per this link from Apple here. The issue is we're using a KVM which keeps disconnecting, then re-connecting the keyboard and every time that happens, our custom key maps get wiped out and we have to manually re-execute the script.

I'm trying to find if there's some system event we can monitor, or some launch agent or similar that we can utilize to execute the script for us automatically.

If there is any other way you can think of that would persist these settings, that would work too.

Ref: https://developer.apple.com/library/archive/technotes/tn2450/_index.html

Memoirs answered 5/2, 2020 at 12:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.