How to Change Default Torrent Client for Magnet Links in Ubuntu 20.04+

Last updated: January 23, 2022 — 3 Comments

When clicking a magnet link in Chrome browser, it pops-up with “Open xdg-open” option allows to launch the default app to start the downloading.

Unlike Firefox, Google Chrome does not offer an option to choose which app to handle the link. Instead, it launches the default app directly. For those want to change this default app to handle magnet links, here’s how to do the trick in Ubuntu.

Click “Open xdg-open” to open link via default app

Step 1: Tell the default app for magnet links:

Firstly, press Ctrl+Alt+T on keyboard to open a terminal window. When it opens, run the command below will tell the default app for magnet links:

xdg-mime query default x-scheme-handler/magnet

Here xdg-mime is the standard wrapper. User may also run this command instead, which will also output the registered applications:

gio mime x-scheme-handler/magnet

Tell the default app for magnet

Step 2: Set/Change the default app for magnet links:

As the previous steps shows, the both command also support for changing the default app. Say set “QBittorrent” as default app for magnet link, use command:

xdg-mime default org.qbittorrent.qBittorrent.desktop x-scheme-handler/magnet

Or use command:

gio mime x-scheme-handler/magnet org.qbittorrent.qBittorrent.desktop

For any other app, replace org.qbittorrent.qBittorrent.desktop in the previous commands via the .desktop file. You may even set an un-registered app as default, and gio command will register it as well.

In addition, by changing the mime type “x-scheme-handler/magnet“, user may use the previous commands to tell (or set) other file type’s default app.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

3 responses to How to Change Default Torrent Client for Magnet Links in Ubuntu 20.04+

  1. Plamen Dzhangyozov January 26, 2022 at 5:31 pm

    How to do this with qBittorrent 4.4.0 which is appimage? This above wont work in ubuntu 20.04.

    • You need to create a ‘.desktop’ file for your qBittorrent Appimage, so it can be launched from start menu (activities overview). Some Appimage do it automatically on first launch, but I don’t know if qBittorrent does.

      And then run the command in this tutorial by replacing ‘org.qbittorrent.qBittorrent.desktop’ in commands.

  2. For anyone else finding this isn’t working for KDE a post I found on the Kubuntu forums, by Rod J, worked for me:

    “Try System Settings, File Associations. Then type in “torrent” in the search box (without quotes). It should show “application -> x-bittorrent” then click on x-bittorrent and you should see on the right “Application Preference Order”. Make sure ktorrent is at the top of the list.”

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.