Skip to content

Filetype handling in Gnome


Trying to solve a similar problem in Gnome, I came up with the following situation: how someone can alter the filetype associations? In other words, which program is responsible for opening/working with a specific type of files and how can we alter this relationship?

It seems to be a rather complicating issue this one in Gnome. I first tried to find out the relevant settings somewhere buried inside the Gconf database, like what is happening in Windows’ Registry. No luck!

It seems that the MIME types (this is the official jargon for naming the filetypes associations) is controlled in Gnome with text configuration files. This is something I prefer as an old UNIX afficionado, but it’s rather unusual and inconsistent with the rest of philosophy in Gnome.

Although Internet is full of information, I couldn’t find enough for this problem. The article that opened my eyes (after a LOT of searching) was this one. So, I’m using it as a guide to the rest of the article.

The files that Gnome uses for the MIME information are the following:

  • /etc/gnome/defaults.list –> /usr/share/applications/defaults.list
  • /usr/share/application-registry/
  • /usr/share/applications/mimeinfo.cache
  • /usr/share/mime-info/
  • ~/.local/share/applications/
  • ~/.gnome/share/apps/

During my research on the subject, I realized that in Gnome jargon you can find gnome-vfs or gvfs describing everything Gnome knows about file-types and applications, except of minor changes that can be described in separate files. I also found many useful utilities starting with the prefix gvfs-, like the gvfs-info.

Temporary Solution

After some “blind” experiments, it seems that the usual and most referenced in Internet method of GUI right-click on a file worked. I know it is a solution, but I need to know more. Yet I’m too confident that there is a lot of background work using text configuration files and Gnome libraries. So, I won’t stop to further investigate the problem and looking forward to find what it actually happens in Gnome regarding the file associations under the hood.

More specifically, at Nautilus I found a file with the type I wanted to change. Right-click on it and click on Properties. From the “Properties” dialog box I chose the “Open With” tab, where I can customize the applications that can handle the specific file-type. More specifically, I can add more applications that can handle the file-type, or remove existing associations, or revert to the defaults, and set the default application (the one that is called with a double-click on the file’s icon). Furthermore, from the “Basic” tab I can also change the icon of these files by just clicking on the icon button and selecting an appropriate icon file from the new dialog box.

By adding more applications to the handler’s list, Nautilus will show these applications in the right-click menu, after the default application handler. Also, and this is not a surprise since it is supposed that all Gnome applications should collaborate and use a conforming environment, the default application handler will start while using the gnome-open command.

From → Gnome

Leave a Comment

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: