6

I have two very similar .desktop launcher files that are to be used as internet shortcuts. When I double click on one file it opens properly in a webbrowser as I would like. When I double click on the other, it opens in a text editor which I do NOT like. How do I change this?

Good shortcut opens in browser:

[Desktop Entry]
Encoding=UTF-8
Name=Safari Books
Type=Link
URL=http://hdl.library.upenn.edu/1017/7026
Icon=text-html
Name[en_US]=Safari Books

Bad shortcut opens in text editor:

[Desktop Entry]
Encoding=UTF-8
Name=Learning Python
Type=Link
URL=http://proquestcombo.safaribooksonline.com/book/programming/python/9780596805395
Icon=text-html
Name[en_US]=Learning Python
Anto
  • 2,661
Selah
  • 2,905
  • @BiggJJ he means that the URL is downloaded but opens in gedit instead of a browser (since it is an XML file) – January Jul 11 '13 at 19:59
  • compare thier file permissions with ls -l – j0h Jul 11 '13 at 20:15
  • I have copied your second .desktop file and made the test, results: the first time I clicked it was opened in Firefox (good), now the second time (and the next...) it does open in GEdit. Not sure but this might actually be a bug. Try reporting it. Curiously Nautilus opens a dialog offering the possibility to cancel. – edwin Jul 11 '13 at 20:27
  • Seriously, this is a bug in Nautilus in my opinion. This behavior is quite unexpected. – edwin Jul 11 '13 at 20:38
  • thanks for feedback! I will look into reporting as a bug. – Selah Jul 15 '13 at 19:18

1 Answers1

6

I don't have a good solution, but I have a solution. You see, the desktop entry specification does not determine the viewer or mime type for a link. A link can be an image, a document, whatever, and the correct viewer will be chosen based on what the file is. And so it happens that this link opens with an editor (and not a browser). You have two options.

However, here is a little change that will result in the correct behavior, although it is ugly. Modify the desktop entry like this:

[Desktop Entry]
Encoding=UTF-8
Name=Learning Python
Type=Application
Exec=xdg-open http://proquestcombo.safaribooksonline.com/book/programming/python/9780596805395
Icon=text-html
MimeType=text/html
Name[en_US]=Learning Python

It will look the same, but it will be an application launcher. Just remember to set the permissions to execute in that case!

January
  • 35,952