1

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

  1. FrontApplicationPresentationModeChanged, received by Safari
  2. PresentationModeChangedBecauseFrontApplicationChanged, received by Safari
  3. BecameFrontmost, received by Safari
  4. LostFrontmost, received by Terminal
  5. MenuBarAcquired, received by Safari
  6. MenuBarLost, received by Terminal
  7. FrontApplicationPresentationModeChanged, received by Terminal
  8. PresentationModeChangedBecauseFrontApplicationChanged, received by Terminal
  9. BecameFrontmost, received by Terminal
  10. 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?

  • You might want to have a look at EventScripts, which has an Entered fullscreen event, under its Spaces Events, that can trigger an AppleScript. It's just $3.99 USD at the Mac App Store Preview. Also take a look at Available Events and Parameters to see all of the events that can trigger an AppleScript. Other then a satisfied customer, I have no other affiliation with Mousedown, the developer of EventScripts. – user3439894 Dec 4 '17 at 15:16
  • Thanks for the suggestion! A very useful app indeed, which I did not know about. Unfortunately, the "Entered fullscreen" event is never triggered. I tried with other events, and the scripts get run as advertised but not "Entered fullscreen"! Does it work for you? And if so, what is your configuration? – frapadingue Dec 4 '17 at 22:06
-1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .