CGEventTapPostEvent fails in Save panel

I have a keyboard macro utility that uses a global event tap, and requires accessibility permission. It works except when typing in the edit field of a standard Save panel. Then it just beeps when I call CGEventTapPostEvent. I'm guessing that has something to do with standard open/save panels running in some special security box ( I forget the term). If I could just turn off my utility in Save panels, that would be good enough, but I can't figure out how to detect that situation. If I look at the result of CGWindowListCopyWindowInfo, I can see the Save window, but I don't see anything special about it. Nor can I think of any way of detecting that the keyboard event I posted has been rejected.

Answered by JWWalker in 743896022

I changed the tap creation to use the location kCGSessionEventTap instead of kCGAnnotatedSessionEventTap, and now it works. Go figure.

Accepted Answer

I changed the tap creation to use the location kCGSessionEventTap instead of kCGAnnotatedSessionEventTap, and now it works. Go figure.

CGEventTapPostEvent fails in Save panel
 
 
Q