Is there a way for AppleScript to detect when a Desktop is switched?
http://piyocast.com/as/archives/5502
https://www.youtube.com/watch?v=8kZbMs1LJt8&amp;feature=youtu.be

You can detect the switch of desktop. Though, Full-screen mode is detected as desktop switching.

Enjoy!