Greetings! I'm currently gathering information that helps software in assessing the user's context. One very important such data would be the application that the user is currently working with which mostly is roughly equivalent to the name of the window that has the focus. Unfortunately I'm at a loss even about which API to ask for this information. As personally I am using compiz as a window manager, I'd be glad if anybody here could tell me about a way to get this information out of compiz, preferably without modifications to its code. If alternatively someone knows about ways to do this at a higher level (freedesktop, X, ...), I'd be happy about any hint. Many thanks in advance and best regards, Christian Mertes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 185 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/compiz/attachments/20100428/299578c6/attachment.pgp>
Hi Christian, This is not really compiz-specific but should work with every window manager: The root window has an Atom _NET_ACTIVE_WINDOW which contains the window id. This is probably what you want. Try it out with: xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" Cheers, Raphael On Wed, 28 Apr 2010 17:51:51 +0200, Christian Mertes <cmertes at techfak.uni-bielefeld.de> wrote:> Greetings! > > I'm currently gathering information that helps software in assessing the > user's context. One very important such data would be the application > that the user is currently working with which mostly is roughly > equivalent to the name of the window that has the focus. Unfortunately > I'm at a loss even about which API to ask for this information. As > personally I am using compiz as a window manager, I'd be glad if anybody > here could tell me about a way to get this information out of compiz, > preferably without modifications to its code. If alternatively someone > knows about ways to do this at a higher level (freedesktop, X, ...), I'd > be happy about any hint. > > Many thanks in advance and best regards, > > Christian Mertes >-- Dipl.-Medieninf. Raphael Wimmer Wiss. Mitarbeiter / Research Assistant LFE Medieninformatik E-Mail: raphael.wimmer at ifi.lmu.de Ludwig-Maximilians-Universit?t M?nchen Skype: real_raphman Amalienstr. 17 / Raum 206 WWW: http://www.medien.ifi.lmu.de 80333 M?nchen Tel: +49 (89) 2180-4659 Germany Fax: +49 (89) 2180-99-4659
A related issue in Compiz is knowing where the cursor is within an application window. When using the enhanced zoom desktop, if you zoom in, and then press Alt+Tab, the newly focused application scrolls into view. However, it just shows the middle of the window. In a gnome terminal, for example, the cursor is usually somewhere on the left side. So, if you find the answer, please post it back here. I'd be very interested in finding a way to start following the cursor. Bill On Wed, Apr 28, 2010 at 11:51 AM, Christian Mertes <cmertes at techfak.uni-bielefeld.de> wrote:> Greetings! > > I'm currently gathering information that helps software in assessing the > user's context. One very important such data would be the application > that the user is currently working with which mostly is roughly > equivalent to the name of the window that has the focus. Unfortunately > I'm at a loss even about which API to ask for this information. As > personally I am using compiz as a window manager, I'd be glad if anybody > here could tell me about a way to get this information out of compiz, > preferably without modifications to its code. If alternatively someone > knows about ways to do this at a higher level (freedesktop, X, ...), I'd > be happy about any hint. > > Many thanks in advance and best regards, > > Christian Mertes > > > _______________________________________________ > compiz mailing list > compiz at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/compiz > >
Addendum: You might also be interested in the atom _NET_WM_PID of a window that - if set - contains the process id of the process owning the window. By the way, three related links: The EWMH spec that describes _NET_WM_PID and other intersting atoms [1]. A nice hack for adding arbitrary atoms (e.g. the file name you passed to a viewer application) to a window on creation [2]. The Zeitgeist project already offers a daemon for collecting usage context (afaik not tracking the active window at the moment) [3] Raphael [1] http://standards.freedesktop.org/wm-spec/1.4/ [2] http://www.mail-archive.com/devel at xfree86.org/msg05806.html [3] http://zeitgeist-project.com/ On Wed, 28 Apr 2010 17:51:51 +0200, Christian Mertes <cmertes at techfak.uni-bielefeld.de> wrote:> Greetings! > > I'm currently gathering information that helps software in assessing the > user's context. One very important such data would be the application > that the user is currently working with which mostly is roughly > equivalent to the name of the window that has the focus. Unfortunately > I'm at a loss even about which API to ask for this information. As > personally I am using compiz as a window manager, I'd be glad if anybody > here could tell me about a way to get this information out of compiz, > preferably without modifications to its code. If alternatively someone > knows about ways to do this at a higher level (freedesktop, X, ...), I'd > be happy about any hint. > > Many thanks in advance and best regards, > > Christian Mertes >-- Dipl.-Medieninf. Raphael Wimmer Wiss. Mitarbeiter / Research Assistant LFE Medieninformatik E-Mail: raphael.wimmer at ifi.lmu.de Ludwig-Maximilians-Universit?t M?nchen Skype: real_raphman Amalienstr. 17 / Raum 206 WWW: http://www.medien.ifi.lmu.de 80333 M?nchen Tel: +49 (89) 2180-4659 Germany Fax: +49 (89) 2180-99-4659