2

I have Ubuntu Gnome installed and I am using i3wm. Everytime I double click a book in Calibre to open it it opens in Mendeley desktop.

This doesn't happen under Gnome.

Could you explain why this happens and how I can fix it?

user10853
  • 1,506
  • 5
  • 21
  • 42
  • I have the same problem; `texdoc` also opens PDFs with Mendeley, but Thunar behaves normally and opens evince. – Raphael Oct 14 '17 at 17:58

1 Answers1

1

The problem seems to be that xdg-open is misconfigured:

$ xdg-mime query default application/pdf
mendeleydesktop.desktop

Sure enough, if I run xdg-open some.pdf it opens with Mendeley. It seems that some applications use xdg-open while others don't.

According to this, the culprit should be in here:

$ cat /usr/share/applications/mimeinfo.cache | grep pdf
application/pdf=evince-previewer.desktop;gimp.desktop;evince.desktop;mendeleydesktop.desktop;
application/x-bzpdf=evince-previewer.desktop;evince.desktop;
application/x-ext-pdf=evince-previewer.desktop;evince.desktop;
application/x-gzpdf=evince-previewer.desktop;evince.desktop;
application/x-xzpdf=evince-previewer.desktop;evince.desktop;
image/pdf=display-im6.q16.desktop;display-im6.desktop;

Looks good to me, except GIMP being there; oh well.

$ cat .config/mimeapps.list | grep pdf
application/pdf=evince.desktop;inkscape.desktop;

Looks fine as well. So the problem could be in an i3-specific config file. But:

$ echo $XDG_CONFIG_DIRS
/etc/xdg/xdg-i3:/etc/xdg

The former folder does not exist, and the second does not contain any .list file.

So I have no idea where this comes from. But running

xdg-mime default evince.desktop application/pdf

does certainly fix it.

Raphael
  • 1,902
  • 16
  • 33
  • [Follow-up question](https://unix.stackexchange.com/q/398141/17409). – Raphael Oct 14 '17 at 18:33
  • That question led to a [script](https://github.com/reitzig/scripts/blob/master/xdg-mime-which.sh) that finds where the default application is set. Not why or by whom, though. – Raphael Jun 29 '20 at 20:46