How to open some files based on extension rather than mime type?
John Hupp
lubuntu at prpcompany.com
Tue Jan 20 23:06:24 UTC 2015
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.
On 1/15/2015 2:39 PM, Israel wrote:
> You could of course use:
>
> /usr/share/applications/defaults.list
> This hold a bunch of the values you'd normally set using xdg-mime
> It usually contains stuff like:
> application/rtf=libreoffice-writer.desktop
> application/tab-separated-values=libreoffice-calc.desktop
> application/vnd.lotus-1-2-3=libreoffice-calc.desktop
> application/vnd.ms-excel=libreoffice-calc.desktop
> application/vnd.ms-word=libreoffice-writer.desktop
>
> Which you can change to whatever you like.
> This should effect using things like:
> xdg-open mydoc.rtf
> from the terminal, and probably from any application that looks at xdg
> mime types.
> The first line in my above excerpt defines that
> libreoffice-writer.desktop will handle this.
>
>
>
> On 01/15/2015 10:38 AM, John Hupp wrote:
>> OK, a happy discovery. LxSession Default Apps does not do the same
>> thing as R-Click: Open With: <app> + checking "Always use ..."
>>
>> If I do the latter with an .odt file, then LxSession Default Apps
>> still has Documents: AbiWord, but odt docs open with LibreOffice.
>> And abw docs open with AbiWord.
>>
>> I see now also that the properties of an odt file show File Type:
>> OpenDocument Text. The format has its own mime type which can be
>> used (but is not used by default) as the basis for the kind of
>> granular control I wanted.
>>
>> So lxsession-default-apps and pcmanfm are apparently doing something
>> different in the back end with mime types. I read somewhere that
>> there are perhaps 4 different mime type configuration files which are
>> respected in some hierarchy.
>>
>> On 1/15/2015 10:17 AM, Andre Rodovalho wrote:
>>> You can set this at*lxsession-default-apps*
>>> *Menu > Preferences > LxSession Default Apps
>>> *
>>> OR
>>>
>>> *Right click* on the file you want to set. Let say, a Document.odt.
>>> On the menu, choose *Properties*. At the Properties windows, select
>>> the software you want to open as default on the "*Open With*"
>>> combobox (drop down menu)... Then hit *OK*.
>>>
>>> Double click the file to see if works...
>>>
>>>
>>>
>>> 2015-01-14 17:57 GMT-02:00 John Hupp <lubuntu at prpcompany.com
>>> <mailto:lubuntu at prpcompany.com>>:
>>>
>>> I don't understand mime types very well, but it seems like the
>>> net effect as implemented is that they don't result in very
>>> granular control.
>>>
>>> To be specific, I find that if I use LibreOffice Writer to
>>> create an .odt file, a double-click on the file in pcmanfm
>>> results in AbiWord opening the file.
>>>
>>> I would like LibreOffice to open odt files, AbiWord to open abw
>>> files, and leafpad to open plain text files. But
>>> lxsession-default-apps merely sets a "Document" launcher.
>>>
>>> Can set up finer control to open some files according to their
>>> extension?
>>>
>>> --
>>> Lubuntu-users mailing list
>>> Lubuntu-users at lists.ubuntu.com
>>> <mailto:Lubuntu-users at lists.ubuntu.com>
>>> Modify settings or unsubscribe at:
>>> https://lists.ubuntu.com/mailman/listinfo/lubuntu-users
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Regards
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/lubuntu-users/attachments/20150120/9a149417/attachment-0001.html>
More information about the Lubuntu-users
mailing list