I don't know who needs to hear this right now, but if you're sending a CGKeyboardEvent with a keycode for a F1-F12 key, you have to also include a kCGEventFlagMaskSecondaryFn flag, even though the key code is specifically for the fn key.
Clean, civil, clueful Mastodon instance for easyDNS members, techies and weirdos. SPAM BOTS WILL BE SUSPENDED