Arch Linux: Open files directly from Chromium in i3 or Awesome

Posted by jason on Dec. 6, 2011, 7:13 a.m.
Tags: arch awesome config i3 linux

These instructions are for i3 without using a desktop environment like gnome or KDE. My problem was that I would download a file in Chromium, and when I tried to open it, it would open the file in firefox before being opened in the appropriate application. Here's the solution I liked, taken from the Arch Wiki's Chromium page.

First, install the xdg-utils-mimeo and mimeo packages from the AUR:

[jason@jason ~]$ yaourt -S xdg-utils-mimeo mimeo

Answer yes to remove the xdg-utils package.

Example: open PDFs directly from Chromium using epdfview

OK, now let's tell mimeo to use epdfview to open .pdf files.

First, find out the .desktop file you'll need for later on:

[jason@jason ~]$ mimeo --app2desk epdfview
  epdfview.desktop  /usr/share/applications/epdfview.desktop

Second, get the mimetype for the file:

[jason@jason ~]$ mimeo -m some-random-file.pdf 

Third, associate the mimetype with the desired .desktop file:

[jason@jason ~]$ mimeo --add application/pdf epdfview.desktop

Restart Chromium (not sure if you need to or not) and download a .pdf file. In the downloads thing at the bottom, right-click and select "Open". The file should be opened directly in epdfview. Notice that the right-click menu also has an "Always open files of this type." If you click that, then .pdf files will be immediately opened in epdfview. Note that a copy is still downloaded to your local machine (to either the default download directory or the last directory you saved a download to?).