Option 1 (Create new Mimetype)
You can try to create a new MimeType (application/gpx) for the gpx files.
Then you can set the gpxviewer
as default application to open them.
For system wide
1) Add the new MimeType to the gpxviewer.desktop.
sudo nano /usr/share/applications/gpxviewer.desktop
Add the following line:
MimeType=application/gpx;
Save the changes in nano with Ctrl+O, Enter then Ctrl+X.
2) Create the new MimeType.
sudo nano /usr/share/mime/application/gpx.xml
Add the following to the gpx.xml file:
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/gpx">
<comment>GPX Files</comment>
<generic-icon name="text-html"/>
<glob pattern="*.gpx"/>
</mime-type>
</mime-info>
Save the changes in nano with Ctrl+O, Enter then Ctrl+X.
NOTE: Please change the content of the file according to your needs.
3) Register the Mimetype.
sudo xdg-mime install --novendor --mode system /usr/share/mime/application/gpx.xml
4) Make the gpxviewer application as default to open gpx files.
sudo xdg-mime default gpxviewer.desktop application/gpx
5) To see the changes you can Logout & Login or run the following:
Result:
Option 2 (Add gpxviewer to the list in application/xml)
For system wide
1) Add the "application/xml" MimeType to the gpxviewer.desktop.
sudo nano /usr/share/applications/gpxviewer.desktop
Add the following line:
MimeType=application/xml;
Save the changes in nano with Ctrl+O, Enter then Ctrl+X.
2) Update the database.
sudo -i
update-desktop-database
NOTE: To make gpxviewer default application to ope the MimeType application/xml ... just run:
xdg-mime default gpxviewer.desktop application/xml
Edit as per comment
AS Glutanimate says.. you can do this not for system wide, you can create the mimetype and add the default application for users like this Answer.
In the ~/.local/share/mime/packages
directory, update with update-mime-database ~/.local/share/mime
.
Add an association in the ~/.local/share/applications/mimeapps.list
file,also you can copy/create a .desktop file into the ~/.local/share/applications/
directory.
Hope this helps.