I am writing an IM client for Mac (in python, but an Objective C / Cocoa solution here is fine). I want to detect whether or not the user is currently watching a movie or playing a game in the foreground, or doing anything else that takes up the entire screen. If so, I won't play a sound when a new IM comes in, but if not, I will play the sound.
How can I detect this? Is there some way to get the foreground window with applescript and look at its dimensions? Or is there some other API call?
Thanks.