ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm wanting to be able to check if a particular application is visible to the user. Is there an application that can check that and return the result? I've been doing some searching on google and the closest I've found is this (which is pygtk)....however this is to check an applications own visibility, not another applications visibility. Any help or direction much appreciated. I'm wanting something that can return the visibility status of any application...
To check if a gtk.Window is visible you can use the visible property inherited from gtk.Widget.
I think so. Basically I'm wanting to check if a screensaver or some other full screen application is running (a game, screensaver or some other full screen app)...
I see. I have never heard of an app that does this, but that doesn't necessarily mean it doesn't exist
I don't even know what sort of term you could use to search for something like that?
Have a look at "xlswins", it will give you a list of all X server windows and "xwininfo -id win_id" that give some information about a window, including its "map state" that shows if the window is viewable or not.
Have a look at "xlswins", it will give you a list of all X server windows and "xwininfo -id win_id" that give some information about a window, including its "map state" that shows if the window is viewable or not.
Yes I did test out the xwininfo 'Map State' thing...unfortunately a window is shown as 'IsVisible' even if it's not visible (ie hidden behind another app or window).
I don't think the X server store layer information, the window manager does so you may want to interact with it/patch it to retrieve that information.
How would you handle transparent overlapping windows by the way ?
This is getting very complicated.
I don't really care about other open applications that are windowed, even if they do cover my application. I'm just concerned with pausing (sleeping) my application if a full screen game or screen saver is started.
I guess you should be able to detect a full screen game by parsing "xlswins -l" output for full-screen windows, remove the root window and any window not viewable.
Concerning the screen-savers, they normally lock the display, so any X11 connection will be refused as long as they are running, easy for you to detect them so.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.