[Top][All Lists]

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

Re: Notifying applications

From: David Chisnall
Subject: Re: Notifying applications
Date: Thu, 21 Feb 2008 15:17:44 +0000

On 21 Feb 2008, at 15:05, Andreas Höschler wrote:

Hi all,

I have a special problem. A foreign non-GNUstep application (actually Star Office) is currently been modified to call a script whenever a user saves a file. I would like to use this to trigger an action in a GNUstep application (grab the Star Office file from the temporary directory and store it in a database).

The question is, how can a script (GNUstep tool) send a notification to a GNUstep application? I used tcp sockets so far for IPC but this does not seem to be appropriate in this case. Any ideas?



If all you need is a notification, then you can send a distributed notification. The simplest way of doing this would be to write a simple tool that would put its arguments into the userinfo dictionary for a distributed notification and then send it.

My code would look something like this:

int main(int argc, char ** argv)
        [[NSDistributedNotificationCenter defaultCenter]
                postNotificationName:@"File Modified"
                object:[NSString stringWithUTF8String:argv[1]
userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:argv[2]]
        return 0;

You'd compile this to something like notify and then call it from your shell script as:

notify "StarOffice" $FILENAME

In your GNUstep code you'd then listen for distributed notifications from the StarOffice application.


reply via email to

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