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.

6
  • Do you have the same problem with xdg-open?
    – dv3500ea
    Apr 17, 2011 at 13:21
  • 1
    @dv3500ea Yes. Exact same problem with xdg-open. BTW. what is xdg-open? Never heard of it.
    – S B
    Apr 17, 2011 at 19:49
  • @This is still driving me crazy, so bounty it is...
    – S B
    Apr 26, 2011 at 20:37
  • I think you might be encountering a bug, I'm getting something similar with Nautilus showing up in the open-with list for files when it shouldn't, so it's likely a bug in Natty somewhere.
    – RolandiXor
    Apr 26, 2011 at 21:01
  • 1
    @S.B: xdg-open is (or should be) the "standard" way of opening files in a distro-agnostic way. It handles all the hassle of finding out which distro/desktop you are using (Gnome, KDE, XFCE, etc), and launches the files using the proper command. In a Gnome enviroment, xdg-open ends up using the modern gvfs-open, while gnome-open is used as a fallback if gvfs-open is not found. Its strongly recomended that you use xdg-open instead of gnome-open, so your scripts/apps/whatever will be much more portable (and future-proof)
    – MestreLion
    Jun 29, 2011 at 3:12

8 Answers 8

15

Removing exo-utils worked for me perfectly.

5
  • Oh, hutch, this worked! Thanks!! I feel bad that the bounty time is over, as you full deserve the points... I only tried your solution now. Don't know why I had exo-utils installed in the first place. Thanks again!!
    – S B
    May 7, 2011 at 12:26
  • I just hit the same problem (where gnome-open and xdg-open could not open anything than directories), and this helped (it removed the whole xubuntu-desktop stuff). Sep 4, 2011 at 1:31
  • 1
    but that would remove xfce :(
    – NoBugs
    Feb 5, 2012 at 8:00
  • It can be fixed without removing exo-utils/xfce: askubuntu.com/a/493866/169
    – blueyed
    Jul 10, 2014 at 1:57
  • This fix also works for gvfs-open misbehaving on Fedora with MATE. The package name on Fedora is exo. You may have installed it by accident with xfburn.
    – nwk
    May 31, 2015 at 12:43
8
+25

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.

5
  • thanks for all the info, but unfortunately this doesn't help (or at least I couldn't do anything useful with it). Here are my findings: /usr/share/applications/defaults.list has acroread as my preferred PDF application (changed it from evince) /usr/share/applications/mimeinfo.cache has all the list of applications that can open PDF files. Nautilus is not listed as one of them ~/.local/share/applications/ had a file names mimeinfo.cache but had no PDF there (maybe I should add it manually??) And lastly, I don't have a directory named ~/.gnome.
    – S B
    Apr 27, 2011 at 10:17
  • @dasgua, thanks for looking into this. Tried gvfs-open and got the same result (i.e. Nautilus opens up). See above that I also tried xdg-open, and nothing changed. First of all, why are there so many foo-open options? Second, the gvfs-option not only did not work, it also made my machine log off... Don't know if it's the gvfs-option fault though, since the same thing happened to me earlier today with google-chrome. I think there's a bug with unity (or compiz) that makes you session self-destroy...
    – S B
    Apr 27, 2011 at 12:23
  • thanks for sticking with me... tried the second approach. Typing the first command simply returned application/pdf as I wasn't sure if this was "what I should expect" I ran the second command (which should read) xdg-mime default evince.desktop application/pdf (it wouldn't let run it the way you referred to it) and still the same thing. Nautilus just opens up... frustrating
    – S B
    Apr 27, 2011 at 22:07
  • thanks for all your effort! Unfortunately... I do have evince.desktop. BTW, setting adobe reader as my default pdf reader also produces the same output, so I was skeptic of this solution from the beginning... :-)
    – S B
    Apr 30, 2011 at 18:20
  • It is my hobby find solutions for software ;-). If you login as another user, does the problem persist?
    – desgua
    Apr 30, 2011 at 19:41
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.

1
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.

1
  • Obvious note that to fix this, you need to remove those lines from the mimeapps.list file Oct 22, 2014 at 12:35
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.

1

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

1
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.

1
-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.

1
  • thanks for the suggestion, but I already tried that. No matter what is set as default, I still get Nautilus to open up.
    – S B
    Apr 27, 2011 at 10:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .