<div dir="ltr"><pre><br></pre>
<b>John Carlyle-Clarke</b> <a style="background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAAXNSR0IArs4c6QAAAahJREFUGNMlwUtrE1EUAOBz5t4MM5kZhqhtVNBaaCAgLjSCrd24ECyCLrQWLCoiSAX/hD9CcOVCRLRFN+JGKLh3JRRTpW2oDyKJyaSTeWXm3jnHhd+HvNgCRKgfGcw22TDgPwKrSL0vn6H7V08SCd0ekIb+oNe60FtY0LYpmMw4PfXxg7u1k2XJWJN4Ml2DJKXhwG9vHTM4bc4XJ4zzb976LzbiKNKaPd9FfeNaOTeTP38ZB2EFwFm6LOtT0fpGqkvH9uwHt2WnY8Sm2L6zbKzdE44dSOhubg5fvR7qsmKb1cd3d1dWkoqUiorRdO3X8qqUrvvsaRxGIwTfMdXDR53VK7kyMS9lRRVeEv2mqjt3tnHzPn56T4XipVvti5dk6pqyZMFS5JQGZH/fPvnjoH/9qt1qqGKiZpqzu929CY2OH2pmSqo0kV/3p6Lxz/nTmWtK/5wWQFA4Xr2+E+zvRWocSNEL2bTaZw5nYgKqYAAkROYBVsuGZf3pU5DL0JLfqqI4iEhrQABGQAYAYGAGQAwdS9aIF9+tExAxo8FMCABoMABwiYx4VPM/s9PX21lOAvoAAAAASUVORK5CYII=) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; padding-left: 15px;" href="mailto:portland%40lists.freedesktop.org?Subject=%5BPortland%5D%20xdg-open%20generic_open%28%29%20functionality&In-Reply-To=" title="[Portland] xdg-open generic_open() functionality">jpcc at bigfoot.com
</a><br>
<i>Tue Apr 22 17:38:49 PDT 2008</i><br><pre>> Dear all-<br>><br>> I have some suggestions for improving this. I found some problems when <br>> using gnome-do under Openbox, since gnome-do uses xdg-open for viewing <br>
> items and in my environment the generic_open gets used. I'd be willing <br>> to submit patches for review although I am a novice shell programmer. <br>> However because of my lack of experience I wanted to float the <br>
> suggestions to see if they even hold water.<br>><br>> (1) generic_open uses run-mailcap. This is rather limited as it<br>> depends on file extensions. It would seem better to use file or<br>> probably xdg-mime to choose how to open the file.<br>
><br>> The mime type could be fetched with:<br>><br>> file --mime "$1"<br>><br>> and extracted from the output and prepended to the filename before<br>> passing to run-mailcap.<br>><br>> However, it looks to me like a better option would be to use xdg-mime,<br>
> since xdg-mime query default "$1" will give you the default application<br>> to open the file.<br>><br>> (2) The open_generic() function should support file URL's with encoded<br>> characters, e.g. <a style="background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAACQSURBVHjajJFdCoQgFIUrZnWuQnzQJ7cyCILgnlyRP8OcOnCzCGY%2BKOzcj9ON1lLK8osXLnifiTEG70QptUsy9t5z0HsPIfAMYROJxvugtWatFWlvuvUDSLXWi0QDBUydczBSSszPJoJUDEkepBjj%2FHguLik%2ByhijtZ73u0tcGUjNw%2BtAzlnGBML6z2%2F5CjAAaG0XfCLnE00AAAAASUVORK5CYII%3D) no-repeat scroll left center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; padding-left: 15px;" href="file://home/user/foo%20bar">file://home/user/foo%20bar</a><br>
><br>> gnome-open supports this format so it would make sense to try and match <br>> it since the above is a valid URL. If not, the docs should be updated <br>> to specifically say that this may not be supported by xdg-open,<br>
> depending on the environment.<br>><br>> (3) Users of Fluxbox, Openbox and other WM's may have gnome-open or the <br>> corresponding KDE or XFCE components installed and may wish xdg-open to <br>> use them.<br>
> <br>> detectDE() could have code added to check for a variable - say<br>> XDG_OPEN_FORCE_DE - and use that value (kde, gnome, xfce, generic)<br>> instead of attempting a detection if it is present.<br><br><br>
Any news on this?<br>It is really annoying that there's no good implementation of any generic way of managing mimetype associations. xdg-open is not really an option when you are not using gnome/kde.<br></pre><br>--<br>
Ferk<br></div>