On 16 déc, 23:31, Peter Hosey <[email protected]> wrote:
> On Dec 16, 2009, at 13:38:13, Frederic wrote:

> > I suspect that, (if setuid with the user ID), I could launch an  
> > AppleScript on his behalf, and send Growl notifications, but it  
> > seems a little bit like a roundabout way
>
> The tricky parts would be running the script as whatever user should  
> receive the notification, and doing so only if that user is logged in  
> on console.

Hello again,

I succeeded in displaying Growl notifications:
- I launch the script if the designated user is logged in
- In the script, I call Growl to send a notification if Growl is
started.

If the designated user is logged in with Growl enabled, the
notification is visible
If the designated user isn't logged in, but another user is, the
script isn't called, so no notification is sent.

So far, so good, but I have a last problem...
If two users are logged in, the designated one and another user, _and_
the actual working user (the one which is using the keyboard and
screen, I'll tell him the 'active' user, because I don't know how it
should be called) isn't the designated user, my software recognize
that the designated user is logged in, and tries to send the
appleScript.
This ends on an error, Growl returns this message:
"_RegisterApplication(), FAILED TO establish the default connection to
the WindowServer, _CGSDefaultConnection() is NULL."

This result surprised me, because I tried before, and growl is able to
send notifications for one user, when it isn't the active user and 2
or more users are connected (I tried myself, launching regularly
notifications, and switching back and forth to another user.)

I don't think I can discover the name of the active user, I don't see
anything in the utmpx database to help me...
Can anyone think of a way to handle this error, or to avoid it?
(I forgot to explain that after the error, the appleScript take about
100% time of one processor, and it has to be killed with activity
monitor, because force quit in Apple menu don't work for it!!!)

Thanks,
Frederic

--

You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/growldiscuss?hl=en.


Reply via email to