View Single Post
Posts: 11 | Thanked: 8 times | Joined on Mar 2010 @ Sabah, Malaysia
#1
Greetings,

I'm writing a simple shell script that needs the user to go to the camera, take a picture, and manually return to xterminal (which is already open previously).

My question: Is there any way I can detect which application currently has the focus from a shell script? Or the reverse: Is there any way that I can check whether an application has been "backgrounded"?

Alternatively, rather than using a "pure" shell script, is there any simple python implementation of the above? In this case I can call the python interpreter to check the application state from the shell script and process accordingly.

Thanks