15

I find this command

sudo update-alternatives –config x-www-browser

I choose Chrome. It works for xpdf, but Evince still starts Firefox after click.

I feel Linux is not standard. I use Linux Mint 8 (Helena) LXDE.

chenge
  • 353

9 Answers9

19

As far as I understand LXDE uses xdg to do calls to applications. This command should fix your issue:

To find out which application opens a pdf file :

xdg-mime query default application/pdf

To set the application to evince

xdg-mime default evince.desktop application/pdf

This should work if your application is registered to the desktop (i.e. if there is a launcher)

phihag
  • 2,806
g24l
  • 959
11

Solving your issue is like voodoo, even when there are "protocols" regarding how and which applications are supposed to open a specific kind of file. You'll see that they're very inconsistent between systems and different desktop environments.

So there's no really a "right" answer. I had a similar problem with firefox, so I'm giving you my solution:

  1. Create a ~/.local/share/applications/defaults.list if it doesn't exist
  2. Add the following

    [Default Applications]
    application/pdf=evince.desktop;
    

    ...or just the last line if there's something before.

4

You can edit your $HOME/.local/share/applications/mimeapps.list file. If this file does not exist, create one.

For illustration's sake, if you want Chromium to be the default browser, add the following line:

x-scheme-handler/http=chromium.desktop

That's all.

slhck
  • 235,242
Auguste
  • 41
4

I had a reverse problem - I want firefox to open the links, but evince started chromium no matter what.

I used strace -o /tmp/output evince to see what functions are called and found this in the log:

open("/home/koniu/.local/share/applications/firefox.desktop;", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/share/applications/firefox.desktop;", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/applications/firefox.desktop;", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/home/koniu/.local/share/applications/chromium.desktop", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/share/applications/chromium.desktop", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/applications/chromium.desktop", O_RDONLY|O_LARGEFILE) = 16

No idea why there's a semicolon included in the firefox.desktop but I created /home/koniu/.local/share/applications/firefox.desktop with the following content:

[Desktop Entry]
Name=Firefox
Exec=/usr/bin/firefox %U
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true

And now evince starts firefox as desired.

koniu
  • 616
3

To change Gnome applications you need to use gconftool:

$ gconftool -s /desktop/gnome/url-handlers/http/command -t string 'chromium-browser %s'

To check the changes:

$ gconftool -g /desktop/gnome/url-handlers/http/command

Other Gnome applications:

/desktop/gnome/url-handlers/chrome/command
/desktop/gnome/url-handlers/https/command
/desktop/gnome/url-handlers/http/command
/desktop/gnome/url-handlers/ftp/command

Reference:

http://www.salixos.org/forum/viewtopic.php?f=15&t=1376&view=print

Gareth
  • 19,080
javier
  • 31
1

None of these solutions worked for me.

I had to edit ~/.config/mimeapps.list and append these rules to the two headers:

[Default Applications]
application/pdf=org.gnome.Evince.desktop

[Added Associations]
application/pdf=evince.desktop;org.gnome.Evince.desktop;
0

I had this problem, using evince under KDE. I had to log out from KDE, login to GNOME, and set the default browser of GNOME (Search -> Details -> Default Applications -> Browser). Then go back to KDE and it worked fine.

mathause
  • 101
0

Set the default browser in Gnome applications with gnome-default-applications-properties.

0

I know this is a very old question... but none of the answers seem to give the correct answer.

First check that these shell commands: xdg-mime query default x-scheme-handler/http and xdg-mime query default x-scheme-handler/https both return firefox.desktop

Then to set Evince (any other Gnome apps that encounter a URL) to use chromium instead:

xdg-mime default chromium-browser.desktop x-scheme-handler/http and xdg-mime default chromium-browser.desktop x-scheme-handler/https