Default Program | File Association

Stanislav Brabec sbrabec at suse.cz
Tue Jan 29 04:48:33 PST 2008


Alexander Larsson wrote:

> > > This way the app-mime association list is fully editable (you can add and remove),
> > > and no duplication of system settings is done (so if the sysadmin updates his higher-level
> > > defaults.list you'll still get those changes, except for the associations that have been
> > > explicitely removed this way).
> > >   
> > >
> > 
> > That's cool. There is just one problem - different desktops have 
> > different default applications. Thus there could be two (or more)
> > 
> > /usr/share/applications/KDE.defaults.list
> > /usr/share/applications/GNOME.defaults.list
> 
> This is up to the distribution/sysadmin/user to handle. If you want to
> do some kind of desktop-specific handling you can just add a desktop
> specific directory to the XDG_DATA_DIR env var. And for extremely
> specific things you can use OnlyShowIn/NotShowIn.
> 
> Doing it with two different files is a very bad idea. I mean, what file
> would a third party app use? And why should a kde and a gnome app
> running in the same session launch different apps for the same files?

Doing it using XDG_DATA_DIR is also a bad idea - GNOME and KDE are not
ready to install desktop files to different directories, if they share
the same prefix. And you want to use KDE applications on GNOME (or vice
versa), if there is no appropriate application in your desktop.

I can imagine additional defaults.list section (backward compatible):

[Preferred Applications]
KDE=amarok.desktop;gwenview.desktop;
GNOME=totem.desktop;eog.desktop;
All=mplayer.desktop

I can also imagine extension to [Default Applications]:
[Default Applications]
application/x-bzip[KDE]=file-roller.desktop

Proposal of default application lookup for certain MIME type:

1. Look at appropriate MIME entry in [Default Applications] with desktop
type keyword (or all appropriate desktop keywords, i.e. GNOME then GTK
or KDE then QT).

2. Look at appropriate MIME entry in [Default Applications] without
desktop type keyword.

3. Look into [Preferred Applications] at desktop keyword and compare
available applications with these in mimeinfo.cache for particular MIME
type.

4. Look into [Preferred Applications] at "All" keyword and compare
available applications with these in mimeinfo.cache for particular MIME
type.

5. Choose any application from mimeinfo.cache.

Steps 3 and 4 have square complexity, but I guess that it is not a big
problem.

-

In OpenSUSE there is a (statically created) GNOME specific defaults.list
using following algorithm, which seems to work well. Proposal mentioned
above recycles the idea.

1. Read /etc/gnome_defaults.conf.

2. Collect all available desktop files.

3. Go through all declared MIME types and search for default application
   in following order:

3.1 Installed application listed in /etc/gnome_defaults.conf for certain
    MIME type.
    (Applications preferred by distro maker or sysadmin for certain MIME
    type.)

3.2 Installed application listed in /etc/gnome_defaults.conf as
    preferred default application.
    ("First class" applications preferred by distro maker or sysadmin.)

3.3 Installed application listed in in /etc/gnome_defaults.conf as
    default.
    (Applications preferred by distro maker sysadmin.)

3.4 Installed application with GNOME in Categories.
    (Standard guess using desktop files with GNOME keyword.)

3.5 Installed application with GTK in Categories.
    (Standard guess using desktop files with GTK keyword.)

3.6 Installed application.
    (Standard guess using all desktop files.)

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec at suse.cz
Lihovarská 1060/12                            tel: +420 284 028 966
190 00 Praha 9                                fax: +420 284 028 951
Czech Republic                                http://www.suse.cz/



More information about the xdg mailing list