discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSWorkspace launchedApplications] issue


From: Richard Frith-Macdonald
Subject: Re: [NSWorkspace launchedApplications] issue
Date: Fri, 3 Aug 2007 07:18:10 +0100


On 2 Aug 2007, at 07:52, Truls Becken wrote:

On 8/1/07, Andreas Höschler <ahoesch@smartsoft.de> wrote:
Hi all,

as the name implies launchedApplications is supposed to return only
launched applications. On MacOSX this works as expected. Under GNUstep
(also with the latest release) I get the full set of installed
applications (whether they are running or not).

Is there a workaround for this bug? Is see that determining this list
is no easy task since it requires some kind of registration mechanism.
What's the current approach in GNUstep for doing that?

I just found some GSDock sources that work ok on MacOSX but not at all
under GNUstep, mainly because GSDock is based on this
launchedApplications method of NSWorkspace which seems to be broken in
GNUstep.

The documentation for launchedApplications warns that the result is
not guaranteed to be up to date. As Yen-Ju mentioned, this is mainly
because crashed applications don't notify NSWorkspace when they
terminate.

That being said, when I have experimented with launchedApplications on
earlier releases, it has worked as documented. It has given
satisfactory results, except when I have killed applications in some
kind of rude way. You should therefore feel free to file a bug report
about getting all installed applications.

It would also be nice if NSWorkspace in some way managed to always
know the correct set of running applications, but I guess that would
require some kind of probing which would affect performance. And not
only when someone asks what is running, but periodically as it's
possible to receive notifications when apps launch or terminate. Since
NSWorkspace knows the PID for each application, checking whether the
process still exists might be good enough.

Yeah ... I've just finished modifying the code to do two things ...
1. check that the pids still exist every time launchedApplications is called... not an infallable check for removing dead apps (as the pid can be re-used), but pretty good generally. 2. check that the apps are still responding if it's more than 30 seconds since the last time launchedApplications was called.

I'm not sure that (2) is a good idea though ... the check has the potential to be very slow and can potentially remove an app from the list when it's only temporarily not responding, rather than permanently hung. Thoughts?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]