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

Nio Wiklund nio.wiklund at gmail.com
Wed Jan 21 17:34:40 UTC 2015


Den 2015-01-21 17:03, John Hupp skrev:
> I found a few more things pcmanfm is NOT looking at by default. 
> 
> Since LXDE also implements some MIME support, I changed the
> document/installed setting to put libreoffice-writer before abiword in
> ~/.config/lxsession/Lubuntu/desktop.conf and
> ~/.config/lxsession-default-apps/settings.conf.  I rebooted, and neither
> setting caused pcmanfm to open an ODT with LibreOffice.
> 
> Since Lubuntu uses the Debian alternatives system to set the default web
> browser, I thought it possible that it might do the same for the default
> word processor.  I had a look through /etc/alternatives but didn't find
> any candidates there.
> 
> And since I had seen an old Firefox bug report where it was looking at
> /usr/share/applications/mimeinfo.cache, I also played with the relevant
> mime type there, also to no effect.
> 
> --JDH
> 
> On 1/21/2015 9:59 AM, Israel wrote:
>> Hi,
>> I want to look into it more.
>> I was just posting more information for anyone who is following this
>> thread, and for my own information, as well.
>> I will try to test this soon.  In 12.04 defaults.list does indeed work
>> with pcmanfm, mimeapps.list would not work (of course). the place to
>> look (or ask) might be on the LXDE github
>> I'm sure PCMan knows how to support this action.  Of course it could
>> also be some patch that is added in by Julian in the packaging (or
>> left over from ealier versions), but that is just a guess.
>> If I get time today I'll pop in on github and look around, and maybe
>> ask what the preferred placement is.
>> This may actually be a bug...
>>
>> On 01/21/2015 08:47 AM, John Hupp wrote:
>>> 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.
>>>>> ....

Hi John,

Maybe you have tried it already, but it is my two cents:

What happens if you remove abiword and gnumeric? Will pcmanfm change its
default to libreoffice?

I guess that you don't want to use abiword and gnumeric anyway.

Best regards
Nio




More information about the Lubuntu-users mailing list