Detect when an application goes fullscreen? 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
etc


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?
I am not sure if this solves your issue or not but the easiest way to detect whether or not a window is full screen would be to compare it's window dimensions to the window dimensions of your "desktop window". See below:

tell application "Finder" to set screenSize to bounds of window of desktop

tell application "Safari" to set windowBounds to bounds of front window

if windowBounds is equal to screenSize then
    return "It's Full Screen"
else
    return "Not Full Screen"
end if