rui lopes notebook

Fix magnet link openning in Xfce / Arch Linux

The current Xfce (4.10) that ships with Arch Linux has an annoying bug of not correctly opening Magnet URIs (e.g. when you click a magnet link from within Chromium). So I had to have that fixed, but doing it took longer that I expected… so I’m creating this recipe for helping you solving the problem more easily.

Chromium handles unknown URI schemes by delegating them to the xdg-open command. Which in turn, detects it’s running under the Xfce desktop and delegates the control the exo-open command. Which fails to open the magnet URIs.

In these instructions you’ll patch the exo package and re-install it with a little patch that fixes that annoying problem.

So let’s get to it! Open a terminal and issue the following commands.

Configure xdg-open to open magnet URIs with the Transmission application:

xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet

NB: this modifies the ~/.local/share/applications/mimeapps.list file.

Get the exo package (contains the exo-open command):

sudo pacman -S abs
sudo abs extra/exo
cd /tmp
cp -R /var/abs/extra/exo .
cd exo

Add the patch into a file:

diff --git a/exo/exo-string.c b/exo/exo-string.c
index 33f86f9..056b36a 100644
--- a/exo/exo-string.c
+++ b/exo/exo-string.c
@@ -429,7 +429,7 @@ exo_str_looks_like_an_uri (const gchar *str)
       for (++s; g_ascii_isalnum (*s) || *s == '+' || *s == '-' || *s == '.'; ++s);

       /* <scheme> must be followed by ":" */
-      return (*s == ':' && *(s+1) == '/');
+      return (*s == ':' && *(s+1) != '\0');

   return FALSE;

Modify the PKGBUILD file to patch the source by adding the prepare function above the existing build function:

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  patch -p1 &lt; "$startdir/fix-exo_str_looks_like_an_uri-bug-10098.patch"

NB to properly finish the package you should also add the patch file name into the source array and its sha256 checksum into the sha256sums array… but I’ll not bother.

And finally build and install the package:

makepkg -s
sudo pacman -U *.pkg*

And that should be it! Try to click on a magnet file link now!