I would like to detect that event from an Applescript. I have found the
lsappinfo command-line app, which has a
listen command that seems to fill my need exactly, but going fullscreen does show up in the output. Here is what I tried. First I ran in Terminal
lsappinfo listen +all forever
Then I clicked on a Safari window, and then clicked on the green button to make it fullscreen, then exited fullscreen and went back to terminal to see the output. I then did it again but without going fullscreen, just clicking on a Safari window, and then clicking back on the Terminal window. In both cases, the sequence of events is
- FrontApplicationPresentationModeChanged, received by Safari
- PresentationModeChangedBecauseFrontApplicationChanged, received by Safari
- BecameFrontmost, received by Safari
- LostFrontmost, received by Terminal
- MenuBarAcquired, received by Safari
- MenuBarLost, received by Terminal
- FrontApplicationPresentationModeChanged, received by Terminal
- PresentationModeChangedBecauseFrontApplicationChanged, received by Terminal
- BecameFrontmost, received by Terminal
The "fullscreen event" should have shown up between 6 and 7 in this list but it is conspicuously absent!
This is on MacOS 10.12.6. It feels like a bug to me. Does somebody know whether it works on other versions of MacOS? Is there any other way to achieve my goal?