views:

57

answers:

1

I was reading the concept of OSX Services and it seemed very cool to me to have utilities like Dictionary, highlight-text-and-open-in-browser and a million other services that provide functionality based on what the user is currently doing.

I have heard it mention that this mechanism is more similar to how pipes work in *nix, rather than background services/daemons. For e.g. , when you highlight text on OSX and select spell-check, it is effectively piping the text (using maybe the Pasteboard) to the dictionary program and returning output.

Let us assume that I have a very resource constrained machine, which means I cant have a zillion background services running - would this (Services/Pasteboard) based approach be more efficient ?

Is there anything similar in Linux ? More precisely, a mechanism to allow me to register my pip services and allow several program to call them. Also, shell pipes may not have strong secuirty built in (conceivably a key-management Service would be affected by this.)

For example, how would you implement a spell-check Service (using a pipe, not a daemon) that constantly checks for spelling mistakes.

Edit: another good read about how OSX Services are not ideal and about their NextStep origins.

+1  A: 

Saying that this is "similar to pipes" is an oversimplification written for consumption by non-technical people. It is, in fact, very little like pipes other than the fact that data is being passed around.

Deskbar-Applet has a mechanism for getting the current selection, if you want to replicate that functionality.

Ignacio Vazquez-Abrams
thanks for the clarification - could you highlight why it is NOT like pipes ? For example, I can conceptually model a JPEG image based service to be 'cat img.jpeg | my_prog'. Is it the Pasteboard that is different (superior?)Basically, I am trying to understand which of the operating-system's message passing paradigms (that I learned in school), does this leverage:named pipes, shell pipes, RPC, etc. What I want is more generic than Deskbar-applet - basically a framework to implement OSX-like services in Linux (rather than background daemons)
Sandeep
A 30-second search in Google find that what OS X calls a "pasteboard" everyone else calls a "clipboard". "Piping" is a specific mechanism whereby a FD of one process is connected to a FD of another process. Piping is ephemeral binary data only, whereas a clipboard persists not only data, but also a small amount of metadata.
Ignacio Vazquez-Abrams