Thursday 10 September 2009

Setting Default Applications in Arch LXDE

LXDE being a very basic desktop environment, there is not much in the way of GUI tools to change your default applications. So for instance when you double click on a PDF does that open in pdfviewer or evince? Or, in a staggering approach to logic, GIMP?

You need to know two things about a file - what its MIME type is, and what application is set to run that file type.

You find out the first element by using the filename of a type you are interested in, in this command in terminal:
xdg-mime query filetype filewithatypeIaminterestedin.pdf
The output will look a bit like this:
application/pdf; charset=binary
For our present purposes, the first part of the response is the important bit. It tells us that the MIME type is "application/pdf". You can now run the following to find out what application is set to run this:
xdg-mime query default application/pdf
Where "application/pdf" is obviously whatever was spat out by the previous command. The results of this command, should be a .desktop file. This is the file in /usr/share/applications which has all the important information about an application. To change this you run the following command:
xdg-mime default epdfview.desktop application/pdf

No comments:

Post a Comment