Cross-desktop helpers

Avery Pennarun apenwarr at nit.ca
Mon Dec 13 18:23:23 EET 2004


On Mon, Dec 13, 2004 at 10:41:56AM +0000, Mike Hearn wrote:

> Alex Graveley wrote:
> >I like the env var approach because it makes it trivial for any desktop
> >environment to point at its preferred copy of magic-exec, instead of
> >trying to put all the logic for all desktops into a single library.
> 
> Sure, I suggested that each desktop had its own lib so gnome-exec would 
> be replaced with DESKTOP_LIB=libgnomedesktop.so.0 or whatever, and any 
> library named in $DESKTOP_LIB conformed to the same interface.
> 
> I'd rather have standards for each different technology though rather 
> than letting each desktop reinvent the default-app (or whatever) wheel. 
> But this seems like a good temporary compromise in the face of limited 
> manpower.

There is no advantage to using a standardized library that runs all your
typical programs instead of a standardized script that runs all your typical
programs.  The earlier proposal was for a simple program that takes
(presumably) an operation (browser, editor, etc), a filename/url, and maybe
a MIME type.  It is easy to pass these in a completely safe way using
execv() and no environment variables, so there is no security hole.  (Using
system() can be a security problem... so don't do that.  mailcap is guilty
for this reason.)  You could also specify the location of this program using
an environment variable, which is also not a security hole and certainly no
less secure that your proposed DESKTOP_LIB variable (ack!).

The newly-started program simply figures out your preferred editor, browser,
etc in some kind of desktop-specific fashion, then runs the relevant
program.

The only conceivable advantage you might get to providing a library instead
of a program is that a library could allow you to do "rich" operations on a
file, sort of like a kioslave or something.  But since there is no
cross-desktop API for dealing with things like that, there is nothing your
library could provide other than please_run_browser(filename) and
please_run_editor(filename), so there's no point... and it requires everyone
to use dlopen() for no reason.

Have fun,

Avery



More information about the xdg mailing list