Sky Watch

Reference Managment & Freedesktop

I have always just put downloaded papers into seperated directories for later use. I name them in the form of "year - title". But I know at some point, I will need a database to manage all of these pieces with odd-looking names. And I have reached this point today. The stuff I need is simple:

  1. Only store locations of file in the database, instead of the files themselves
  2. Tag support
  3. Project/topic/whatever tree
  4. Open PDF and others with program of my choice
  5. Ability to change the location in which I store all the files.

I was fully-prepared to write my own paper manager when I first thought about this. But nonetheless I read this Wikipedia entry, and looked into each free (as in “freedom”) reference manager it mentioned. Sadly most of them were search-based. While there was nothing wrong with that, I would just use Google Scholar when I need to search. And then there were few left. Zotero was one of them. The problem of it to me was being too popular, and popular, in my mind, is somewhat equivalent to slow, big, and ugly-written. I thought I should check it out just to have an idea what features a full-featured reference manager has. So I installed it, and fired it up.

Its biggest advantage, as is advertised, is the ability to utilize the address bar to quickly add articles, which is totally useless to me, because I hide the space-wasting address bar. It supports the first three things I need. I am not sure about the last one, but since Zotero uses Sqlite, I can probably manipulate the database itself to do that. The issue is the second last one in the list. When I chose to open a PDF in Zotero, it oddly opened Inkscape. There was no option in its preference panel to change this behavior. First I thought naturally that it may used Firefox to open anything. But no, I set Firefox to ask me when encountering a PDF. And it would be totally stupid that Zotero was hard-coded to use Inkscape. So there was only one possiblity—it used “system defaults”.

As we all know, Linux itself does not know how to open a certain kind of file. This behavior is governed by desktop environments, which all follow the Freedesktop standard. When a file is opened by xdg-open (or gnome-open, etc.), its mime type is checked, and it is opened according to the corresponding desktop file. The mime type of a file can be queried with

xdg-mime query filetype FILENAME

And its corresponding desktop file can be queried with

xdg-mime query default MIMETYPE

Then to set a different desktop file to be associated with a mime type, do

xdg-mime default DESKTOP MIMETYPE

in which DESKTOP is only the basename of the desktop file. The full name will be looked up inside directory applications inside $XDG_DATA_DIRS and $XDG_DATA_HOME. So it is only a matter of writing a proper desktop file for my home-made, super fast and totally awesome PDF viewer to solve the PDF opening issue in Zotero. I copied and modified an existing desktop file for Evince, and it worked well.

I am still considering writing my own reference manager, but Zotero has to do for now.

BTW, Zotero can show the current selected entries in a file manage, and for that I installed Thunar, the file manage in Xfce. With the A New Hope GTK theme and the Faenza icon theme, it looks awesome.

Thunar screenshot