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