Change Default Torrent Client for Magnet Links in Ubuntu 24.04 | 22.04

Last updated: October 3, 2024

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 automatically.

In addition, in case you don’t know the filename of the .desktop file for your app, try running following commands one by one to find it out:

  • First, open terminal and run command to install mlocate (or plocate for 22.04 & higher):
    sudo apt install mlocate plocate
  • Then, update the database:
    sudo updatedb
  • Finally, search the .desktop file for your torrent app:
    locate "*ransmission*desktop"

    In command, replace ransmission with the keyboard for yours. Its case sensitive! I skipped the first letter because which one (‘T’ or ‘t’) is in use for the file-name.

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 let me know if the tutorial is outdated! 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 |

10 responses to Change Default Torrent Client for Magnet Links in Ubuntu 24.04 | 22.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.”

  3. After a missclick I can’t change back to qbittorrent, even though the terminal returns it as default handler. When I click a magnet link in Chrome it still open the old non working software. Any idea ?

  4. Thank you very much. It helped me default to qbittorrent instead of popcorn-time in Kubuntu 22.04

  5. Thank you, Ji

  6. Now my magnet link downloaded with transmission not with stremio lol.
    Ubuntu 22.04
    Thank you so much