retitle 389367 Support searching /usr/share/mime/packages for mime info
severity 389367 wishlist
thanks

On Mon, Sep 25, 2006 at 05:11:20AM -0500, nate moseman wrote:
> Fish is a attempt at a intellegent shell. One of the features that it
> has is the ability to detect the mime types of files and then launch the
> user's prefered application to open that file. It does this with the
> 'open' built-in command. Also there is a tool called 'mimedb' that is
> supplied with the the fish package that you can use to see how files are
> handled by the shell.
> 
> To do all this correctly it follows the Freedesktop.org convention of
> the '.desktop' files and their mimetype database. This stuff is
> supported by Debian and should work more-or-less.

Based on my reading of Freedesktop's site, mimedb is behaving as it
should be.  If there is no $XDG_DATA_DIRS environment variable, it looks
through /usr{,/local}/share to find the mime type.  If it finds the
mime type (as it does in your case), it then looks through
$XDG_DATA_DIRS for an applications/defaults.list file that instructs it
as to which application to use.  If that application is found, mimedb
then checks /usr{,/local}/share/applications/$app.desktop (which is
determined from defaults.list) for the Exec= line to see how to invoke
the program.

Where this falls apart is that there is no
/usr{,/local}/share/applications/defaults.list.  That seems to be stowed
away under DE-specific directories such as
/usr/share/gnome/applications/defaults.list.  At the same time, it
doesn't make sense for Debian to ship
/usr/share/applications/defaults.list because its contents would depend
on what packages are installed.

For the time being, I can propose that upstream improves mimedb to
search $XDG_DATA_DIRS/packages/$package.xml to see if any of those files
advertise being able to edit the given mimetype.  If so, then it could
find $package.desktop like normal.  It doesn't look like many packages
utilize $XDG_DATA_DIRS/packages though.  I currently only have one
application listed there.  packages.debian.org only lists 36
applications registered in this manner.

> So I have a plain text file I should be able to go:
> open suchandsuch.txt 
> 
> But nothing happens.
> With mimedb you can go:
> mimedb suchandsuch.txt
> 
> and it will return:
> plain/text
> 
> but if you go 
> mimedb -a suchandsuch.txt
> (a for action for the open command)
> 
> It will return nothing.
> 
> To get it to work you have to go in through nautilus and go through the
> right-click preferences dialog and select the program you want to use.
> Then it will work.

It sounds like this is modifying something in $XDG_DATA_DIRS that fish
can see.  Maybe another application is setting $XDG_DATA_DIRS to
encompass more than just /usr{,/local}/share.

> What should happen is that it will choose the same generic commands that
> nautilus (or whatever Debian has by default) to open files when you
> double click them. You shouldn't have to select a action manually for
> each file type.

As mentioned above, part of the reason Nautilus knows what to do is
because Gnome has stuff squirrelled away in /usr/share/gnome/.

> How to fix it.. I don't know. You would have to choose actions based on
> desktop environment.
> 
> Probably a nice fix would be a command used to assign programs to be
> launched or a error message explaining that it doesn't know and you
> have to assign a action via nautilus or whatnot so your personal
> ..desktop preferences are known. Something like that.
> 
> How exactly fish is to know if your running KDE vs Gnome or what to do
> when your running something like Fluxbox or Ion3 I don't know.

This is also something that's been discussed on fdo's mailing lists.
There hasn't been a conclusion yet and the mime work seems to be on hold
for right now.

-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]>

Attachment: signature.asc
Description: Digital signature

Reply via email to