Identifying applications from windows to .desktop files
fgouget at codeweavers.com
Wed Feb 25 02:23:10 PST 2009
Milan Bouchet-Valat a écrit :
> Le mardi 24 février 2009 à 23:38 +0100, Francois Gouget a écrit :
>> On Sun, 22 Feb 2009, Milan Bouchet-Valat wrote:
>>> We are now tracking applications usage to build stats and present the
>>> user with the most used apps. For this, we identify windows with their
>>> WM classes, and want to map this to a specific application, i.e.
>>> a .desktop file.
>> Why start from the window name/class? Why not enumerate running
>> processes to identify which binary is running? From that binary it seems
>> like you could get back to the package name if needed.
> Well, first, we don't want to track background processes, but only
> applications we've seen the user interacting with. The model is clearly
> centered around objects that the user works with, which are windows.
Hmmm, I believe I understand. The term application is misleading because
what you really want to track is usage of the Start Menu entries.
But then that raises another question. Why not simply track the clicks
on these entries in the Start Menu? This would tell you precisely how
many times a given entry has been used.
> Sure, we could see what command was used to start the app owning a given
> window, and then get the desktop file associated with it. But this
> method suffers from the same problems, as I said before in this thread:
See, I was more equating applications with packages. So I would rather
have mapped the binary to the corresponding system package. But since
what you want to track is Start Menu entries, obviously that would be no
> This approach assumes that there's no alternative way other than the one
> referenced in the .desktop file to start the window.
Which is obviously a bad assumption. For instance I use XEmacs every day
and I can tell you I never once started it from the Start Menu.
You will also have false positives. For instance I use the Firefox I
downloaded from Mozilla.org. So if you see a window called 'Firefox',
will you assume that this matches the .desktop file called
'firefox.desktop'? If you do you'll make a mistake because the desktop
file refers to /usr/bin/firefox while the one I run is
You will also make a mistake if any '.desktop' file contains a URI that
causes it to be opened in some application. This could be some
documentation in a PDF format, or maybe an html file in a web browser.
You will think that the user uses 'firefox.desktop' every day when in
fact he's using 'OpenOffice Tutorial.desktop' every day.
> This is tricky and IMHO makes us go really far from the direct
> relationship between applications, windows they own, and .desktop files
> they're described by.
I don't see any direct relation between applications, .desktop files and
even less windows. And certainly not a one to one mapping.
I guess my perspective is also colored by my work on Wine. Microsoft
Word does have a desktop file, but I doubt its window properties will
let you match the two. But then maybe you don't care about applications
that are not shipped with the OS. But then, if your goal is to optimise
the presentation of the Start Menu to show the most used entries, then
you cannot afford to ignore an application on this ground.
fgouget at codeweavers.com
More information about the xdg