[Portland] xdg-open generic_open() functionality

John Carlyle-Clarke jpcc at bigfoot.com
Tue Apr 22 17:38:49 PDT 2008


Dear all-

I have some suggestions for improving this.  I found some problems when 
using gnome-do under Openbox, since gnome-do uses xdg-open for viewing 
items and in my environment the generic_open gets used.  I'd be willing 
to submit patches for review although I am a novice shell programmer.  
However because of my lack of experience I wanted to float the 
suggestions to see if they even hold water.

(1) generic_open uses run-mailcap.  This is rather limited as it
depends on file extensions.  It would seem better to use file or
probably xdg-mime to choose how to open the file.

The mime type could be fetched with:

file --mime "$1"

and extracted from the output and prepended to the filename before
passing to run-mailcap.

However, it looks to me like a better option would be to use xdg-mime,
since xdg-mime query default "$1" will give you the default application
to open the file.

(2) The open_generic() function should support file URL's with encoded
characters, e.g. file://home/user/foo%20bar

gnome-open supports this format so it would make sense to try and match 
it since the above is a valid URL.  If not, the docs should be updated 
to specifically say that this may not be supported by xdg-open,
depending on the environment.

(3) Users of Fluxbox, Openbox and other WM's may have gnome-open or the 
corresponding KDE or XFCE components installed and may wish xdg-open to 
use them.

detectDE() could have code added to check for a variable - say
XDG_OPEN_FORCE_DE - and use that value (kde, gnome, xfce, generic)
instead of attempting a detection if it is present.




More information about the Portland mailing list