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.
Don't have an account? You can sign up here