Part 1 introduced the xdg-mime command to change the default application for a file type. If you want a GUI method, or more tweaking is required after running the command, this post is for you.
File managers can create file associations - the assigning of a default application to open files of a certain extension. Below is an example of changing the PDF default application using the Nautilus file manager for the GNOME desktop.
- Open Nautilus, and navigate to any PDF file.
- Right click on the PDF file, and select Properties.
- Click to open the Open With tab.
Note that this screen identifies the current Default Application -Document Viewer, an alias for evince.
- Select the new default application.
If you find the application you want under Recommended Applications, click the app and then the Set as default button. Otherwise, click the Show other applications button to display more application choices.
If the application you want, say xpdf, is not listed under Recommended or Other applications, first make sure that it is installed.
If the application is installed, but not listed in the Open with tab,
- Edit the application's desktop file - xpdf.desktop.
The desktop file can exist in 1 or both of the following locations.
- Append %U to the end of the Exec= line.
The Exec= line specifies the command and any arguments to start the application. If the Exec= line does not specify that the application can take command line arguments, the application is omitted from the Recommended applications and Other applications lists.
The Exec= line in the xpdf.desktop file should look like the following:
%U indicates that the xpdf command can take multiple URLs as arguments.