23

I configured evince to be my default application to open pdf files (using Open with... and clicking on always opening pdf files with this application), but when I type gnome-open foo.pdf instead of evince, I have Nautilus that opens up in the correct folder highlighting the file of my choice.

This is especially disturbing since I am using the LaTeX plugin for gedit, and when I try and compile a tex file to pdf, instead of opening up a new window with my compiled pdf file, I just have nautilus pop-up. I know I can edit the scripts of my gedit LaTeX plugin to call on evince (or acroread) with the pdf I want opened, but this is a workaround and not the solution I am looking for.

Pandya
  • 37,289
S B
  • 809

8 Answers8

15

Removing exo-utils worked for me perfectly.

8

Forth Approach

I could reproduce your problem by deleting this file /usr/share/applications/evince.desktop, so make sure you have this file.

Reference.

Third Approach

xdg-open appears to use the configuration of /etc/mailcap. So edit it to associate pdf with evince.

gksu gedit /etc/mailcap  

Look for the lines that begin with application/pdf; application/x-pdf; application/x-bzpdf; application/x-gzpdf. They should look like this to associate pdf with evince:

application/pdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf
application/x-pdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf
application/x-bzpdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf.bz2
application/x-gzpdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf.gz

Reference.

Second Approach

What is the output of

xdg-mime query filetype foo.pdf  

If the output isn't what we should expect, then:

xdg-mime default evince.desktop application/pdf   

Reference.

First Approach

There are other places that the file associations are set.

You may change the files associations at:

/usr/share/applications/defaults.list 
/usr/share/applications/mimeinfo.cache
~/.local/share/applications/  
~/.gnome/share/apps/ 

Look for "pdf" and for "Nautilus" inside theses files.

desgua
  • 33,215
5

I just ran into this problem today, and according to this thread on ubuntuforums.org, it's caused by exo-utils:

http://ubuntuforums.org/showthread.php?t=1729680

exo-tools is a dependency of Thunar (which I installed today), but isn't normally installed in stock Ubuntu, which I guess is why they missed this bug in release.

Removing this packaged (I actually just removed Thunar and all it's deps) fixed the problem for me.

bj0
  • 51
4

The problem is related to exo-utils.

  1. there is a bug, which has been fixed for Ubuntu Utopic: https://bugs.launchpad.net/bugs/956255

  2. for some reason, the following x-scheme-handler lines got copied/sticked in ~/.local/share/applications/mimeapps.list

    % grep exo ~/.local/share/applications/mimeapps.list 
    x-scheme-handler/file=exo-file-manager.desktop
    x-scheme-handler/trash=exo-file-manager.desktop

This caused xdg-open/gvfs-open to use /usr/share/applications/exo-file-manager.desktop, which contains:

Exec=exo-open --launch FileManager %u

This is the reason that even with the fixed package, it still opened Nautilus for every file.

blueyed
  • 9,125
1

I had the same problem after installing nautilus to manage my files under Xubuntu 11.10. When I moved back to plain Ubuntu 12.04 the problem was there too.

Simple solution if this happens ONLY to your user (close to what desgua already said): delete ~/.local/share/applications directory and everything should go back to normal. You may want to backup some shortcuts inside that directory if you want to preserve them.

penreturns
  • 5,950
nesuribe
  • 81
  • 1
  • 2
1

The problem is coming from thunar and exo-utils (which is needed by thunar). Removing them solves the problem.

Eliah Kagan
  • 119,640
1

I had a similar issue, removing exo-utils did not work for me.

After a little digging I found two entries for application/pdf in /etc/mailcap that were prioritizing Xpdf over evince.

After commenting out the two entries for Xpdf, xdg-open correctly opens pdf documents with evince.

kisoku
  • 551
-1

Working fine for me, gnome-open opens up Adobe Reader properly. Could you try with Adobe reader once.

Might be the case that evince is not properly set as default somewhere.

I am using Natty BTW.

Madhava
  • 459