gcmd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gcmd-dev] mimetypes handling


From: Michael
Subject: [gcmd-dev] mimetypes handling
Date: Wed, 17 Jun 2015 16:29:07 +0200

A short overview of relevant files.

== mimeapss.list ==

mimeapss.list recognises these headers:

[Default Applications]
[Added Associations]
[Removed Associations]

where "Added Associations" should be used for custom choices.

The system default file is in /usr/local/share/applications/.  

Obviously there has to be a $HOME file for user choices too, which would be 

$HOME/.local/share/applications/mimeapps.list

but now seems to be deprecated (see below), and now is (more logically:)

$HOME/.config/mimeapps.list

https://wiki.archlinux.org/index.php/Changing_filetype_association_via_MIME  
tells us that desktop specific files are possible, too:

$HOME/.config/$desktop-mimeapps.list    user overrides, desktop-specific
$HOME/.config/mimeapps.list     user overrides
/etc/xdg/$desktop-mimeapps.list         sysadmin and vendor overrides, 
desktop-specific
/etc/xdg/mimeapps.list  sysadmin and vendor overrides
$HOME/.local/share/applications/$desktop-mimeapps.list  for compatibility but 
now deprecated, desktop-specific
$HOME/.local/share/applications/mimeapps.list   for compatibility but now 
deprecated
/usr/local/share/applications/$desktop-mimeapps.list and
/usr/share/applications/$desktop-mimeapps.list  distribution-provided defaults, 
desktop-specific
/usr/local/share/applications/mimeapps.list and
/usr/share/applications/mimeapps.list   distribution-provided defaults 

and there can be desktop specifics even inside a .desktop file too.


== mimeinfo.cache ==

The file resides in /usr/share/mime/ and there are several more related files, 
like "globs" and "globs2" (telling the file suffixes), or "magic" (identifying 
file headers).

I can't really tell what exactly is in there since mimeinfo.cache contains 
binary data (congrats, freedesktop!); if you need to know the specs:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#idm140625828626720

and if you look into it (with strings or mcview) there's an awful lot of 
clutter, like "Windows Registry" entries or Google links...i hate this.

From archwiki: "When the program update-desktop-database is run (usually as 
root during the (un)installation of a package), it updates files called 
mimeinfo.cache in the /usr/local/share/applications and /usr/share/applications 
directories. These files keep track of which MIME-types are associated with 
which .desktop files overall. This file should not be edited by the user."

After inserting a new mimetype, system runs:
update-desktop-database ~/.local/share/applications
update-mime-database    ~/.local/share/mime



== What about gcmd ? ==


lsof shows me that gcmd opens these locations:

/usr/share/mime/mime.cache

$HOME/.local/share/mime/mime.cache

( An strace shows some more locations where gcmd searches, like 
/usr/share/gnome-commander//mime/mime.cache )

I quick test reveals that $HOME/.local/share/mime/mimeapps.list is not 
recognised by gcmd. Instead, it reads ion the same place the file 
"mimeinfo.cache" which more or less contains the same kind of data, but a 
different header [MIME Cache]. It does not work to symlink this file from 
mimeapps.list, most probably for the different header.


== What to do ? == 

* Make gcmd recognise the mimeapps.list file in $HOME/.config

* As a user, symlink $HOME/.local/share/mime/mimeapps.list from 
$HOME/.config/mimeapps.list (experimentally).

* A valid solution should be using the freedesktop.org recommended file open 
application "xdg-open".

archwiki: "xdg-open is a desktop-independent tool for starting default 
applications. Many applications invoke the xdg-open command internally. 
xdg-open uses xdg-mime to query ~/.local/share/applications/mimeapps.list 
(among other things; if you use a mainstream DE like GNOME, KDE or LXDE, 
xdg-open might try using their specific tools before xdg-mime) to find the MIME 
type of the file that is to be opened and the default application associated 
with that MIME type. See xdg-open for more information." 

--------------
As a OT sidenote, the only application of my desktop which used 
.config/mimeapps.list was the browser Pale Moon (which btw. is a fast firefox 
clone, ripped off the amazing internal / hidden communications of firefox with 
Google, for example telling any URL you click, and your Geolocation). If you 
ever configured your own browser choice note that the mimetypes got extended 
like this: (example for 'browser', exchange th string to your choice):

x-scheme-handler/http=browser.desktop
x-scheme-handler/https=browser.desktop
x-scheme-handler/ftp=browser.desktop
x-scheme-handler/chrome=browser.desktop
text/html=browser.desktop
application/x-extension-htm=browser.desktop
application/x-extension-html=browser.desktop
application/x-extension-shtml=browser.desktop
application/xhtml+xml=browser.desktop
application/x-extension-xhtml=browser.desktop
application/x-extension-xht=browser.desktop




reply via email to

[Prev in Thread] Current Thread [Next in Thread]