PDA

View Full Version : Determining what application a window belongs to/TTD with C


RAOF
January 16th, 2007, 03:59 AM
I'd like to write plugin that groups windows by application and allows you to <Super><Tab> (or whatever) your way through them. Like OSX :). Ideally, I'd also add an option to Switcher to have it tab through applications only.

I thought I'd start by abusing the forums by asking two questions without really looking at code yet:
1) What is the best way of working out what windows are owned by what application, or what possible ways are there and what are their cost/benefits?
2) Does anyone know any good unittest systems for C? I really like the test-driven-development cycle, and would like to continue using it :).

Also, any suggestions for functionality you'd like to see in such a plugin?

mikedee
January 16th, 2007, 04:29 AM
1) What is the best way of working out what windows are owned by what application, or what possible ways are there and what are their cost/benefits?

_NET_WM_PID will give you the process id, you should be able to get the application from that.

You should also look at WM_CLASS since it gives the same information you want.

Have a look at state it does similar things to what you want to do.

RYX
January 16th, 2007, 01:44 PM
Hi RAOF! If you are using libwnck the WnckWindow and WnckApplication could be of interest (though maybe compiz doesn't use wnck, maybe only the decorator does) ...

:)

gasol
April 17th, 2007, 03:58 PM
Hello

Dialogs and such that belongs too an application sets the TRANSIENT_FOR property to the window it is transient for, so by using XGetTransientForHint / XGetWindowProperty you can at least figure out which dialogs / popups belongs to a application.

maniac
April 17th, 2007, 05:02 PM
Hello

Dialogs and such that belongs too an application sets the TRANSIENT_FOR property to the window it is transient for, so by using XGetTransientForHint / XGetWindowProperty you can at least figure out which dialogs / popups belongs to a application.
Right. I believe that TRANSIENT_FOR property is stored in (CompWindow*)->transientFor in Compiz. The scale plugin uses exactly that functionality so it might be a good idea to look at that one.