Changing default applications, for developers

24 February 2010 at 7:33 pm Leave a comment

When not using those uber-featured desktop environments (such as KDE or Gnome) out there, it can sometimes be challenging to find a simple, text-based way of configuring things. For example, I am currently writing a GTK2 program, which uses the method gtk_show_uri to open files using default programs: on the computer I am using at work, this results in opening Acrobat Reader over an XDMCP connection, which is really distasteful. Even using GNOME’s control center, there does not seem to be a way to change that. What should I look at?

There does not seem to be an official XDG standard for defining preferred applications, but standard environments (in my case, the culprit is the GIO library) use the following mechanism: look for a mimeapps.list file in the XDG directories. It should contain user preferences, for example

~/.local/share/applications/mimeapps.list:
[Added Associations]
application/pdf=xpdf.desktop

[Removed Associations]
application/pdf=AdobeReader.desktop

It specifies preferred or unpreferred applications to be used with a given MIME type. The (system) default choices are stored in a defaults.list file, which can be found at /usr/share/applications/defaults.list for example.

Thus, goodbye bloated Acrobat Reader.

Entry filed under: sysadmin. Tags: .

Merry Christmas from a dying blog Creating executables for Windows from a Linux box

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Trackback this post  |  Subscribe to the comments via RSS Feed


Pages

Categories


%d bloggers like this: