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