How to open some files based on extension rather than mime type?

John Hupp lubuntu at prpcompany.com
Wed Jan 21 14:47:10 UTC 2015


In my very modest test using a /etc/xdg/lubuntu/mimeapps.list (a 
location provided by $XDG_CONFIG_DIRS) to associate the ODT mime type 
with LibreOffice Writer, pcmanfm did not respect that.  It still opened 
an ODT file with AbiWord.

It seemed to me that Lubuntu 14.04 was not respecting either 
/usr/share/applications/defaults.list or the new spec, but my testing 
was very far from exhaustive.  In fact, I stopped at a point of 
puzzlement over what pcmanfm was reading to get its default file 
associations.

Did you find that Lubuntu 14.04 (or perhaps 14.10?) is supporting the 
new spec in part or in whole?  Or are you just saying that you want to 
look into it more?

On 1/21/2015 8:15 AM, Israel wrote:
>
> Hi John,
> Thanks for finding this!!
> I will have to experiment with using mimeapps.list some.
> For all who are interested here is the spec...
>
> $XDG_CONFIG_HOME/$desktop-mimeapps.list 	user overrides, 
> desktop-specific (for advanced users)
> $XDG_CONFIG_HOME/mimeapps.list 	user overrides (recommended location 
> for user configuration GUIs)
> $XDG_CONFIG_DIRS/$desktop-mimeapps.list 	sysadmin and ISV overrides, 
> desktop-specific
> $XDG_CONFIG_DIRS/mimeapps.list 	sysadmin and ISV overrides
> $XDG_DATA_HOME/applications/$desktop-mimeapps.list 	for completeness, 
> deprecated, desktop-specific
> $XDG_DATA_HOME/applications/mimeapps.list 	for compatibility, deprecated
> $XDG_DATA_DIRS/applications/$desktop-mimeapps.list 
> distribution-provided defaults, desktop-specific
> $XDG_DATA_DIRS/applications/mimeapps.list 	distribution-provided defaults
>
>
>
> Based on that I think you should save the file as (for local users):
> ~/mimeapps.list
> ~/lubuntu-mimeapps.list (mayeb lxde??)
>
>
> then run
> echo $XDG_CONFIG_DIRS
> if you want to find the specific global directories to change the
> ## I am using an array here below to indicate you can *probably* use 
> any directory listed)
> ${XDG_CONFIG_DIRS[*1*]}*/mimeapps.list*
> or one of these:
> lubuntu-mimeapps.list
> lxde-mimeapps.list
>
>
> On 01/20/2015 05:06 PM, John Hupp wrote:
>> I was looking at this further, and found out that 
>> /usr/share/applications/defaults.list was officially deprecated in 
>> 4/14.  See, for instance, 
>> https://mail.gnome.org/archives/distributor-list/2015-January/msg00000.html 
>> and also the current spec at 
>> http://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html 
>> which instead specifies the use of a mimeapps.list at one location or 
>> another.
>>
>> Lubuntu 14.04 seems to implement some sort of mixture of the 
>> deprecated and current spec.  I have not been able to pin it down 
>> with precision.
>>
>> The LibreOffice installation wrote a full complement of mime type 
>> associations to /usr/share/applications/defaults.list. But PCmanFM 
>> does not look at that -- it opens an ODT file with AbiWord.  I have 
>> yet to figure out what it looks at by default.  Anyone know?
>>
>> If I R-click on a file: Open With and check the box to make the 
>> current app the default for opening the file, then PCmanFM writes to 
>> ~/.local/share/applications/mimeapps.list with the minimal entries 
>> required to set the desired mime type association.  And then for the 
>> current user, ODT files open with LibreOffice.
>>
>> Oddly enough, though PCmanFM writes to a mimeapps.list (named per the 
>> new spec), ~/.local/share/applications is not one of the lookup 
>> locations in the new spec.
>>
>> I copied ~/.local/share/applications/mimeapps.list to 
>> /etc/xdg/lubuntu/, which is a lookup location in the new spec.  Then 
>> I created a new user and found that my global mimeapps.list was 
>> ineffective.
>> ....
>>> -- 
>>> Regards
>>>
>>>
>>
>
>
> -- 
> Regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/lubuntu-users/attachments/20150121/db557482/attachment.html>


More information about the Lubuntu-users mailing list