Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a magnet link from a browser does not work if Tribler is not already running. #8460

Open
nextgenthemes opened this issue Feb 25, 2025 · 4 comments

Comments

@nextgenthemes
Copy link

I have this small issue

Triber v8.0.7
Ubuntu 24.10
Brave browser.

When I open magnet links through Brave and make them open in Tribler, it will start the program, but it will NOT add the torrent. Only when I do it again when Tribler is already running, the torrent is added.

I think this is a Linux specific issue as I believe I did this in windows with 8.x at some point and it worked.

@qstokkink
Copy link
Contributor

I tried to reproduce this, but I can't find how to associate file types with applications in Brave. How did you set that up?

@nextgenthemes
Copy link
Author

@qstokkink What version of Brave are you using? The version from the official apt repo or the snap version? Can't tell you exactly how the process went of associating Tribler, but it was self-explanatory, now I am getting confirmation dialogs where I can allow a specific website allow opening magnet links in Tribler or and optionally check to never ask again.

@qstokkink
Copy link
Contributor

I installed it using (following https://brave.com/linux/):

curl -fsS https://dl.brave.com/install.sh | sh

This gave me:

[Version 1.75.180 Chromium: 133.0.6943.126 (Official Build) (64-bit)](https://brave.com/latest/)

If I go to a torrent link, it just downloads the file. I don't see any options to open torrents with external applications.

@nextgenthemes
Copy link
Author

What do you mean by torrent link? I am talking about magnet links, not links to torrent files. Two different things. What you mean by downloading. Is it starting the buildin Webtorrent client? You need to disable that. Or just downloading the torrent file? Again magnet link then.

Below is what Grok AI gave me when I asked "How to associate magnet links with Tribler on Ubuntu in Brave browser" maybe that is helpful.

To associate magnet links with Tribler on Ubuntu in the Brave browser, you need to configure your system so that magnet links are handled by Tribler instead of Brave's built-in WebTorrent feature or another torrent client. Here’s a step-by-step guide:
Step 1: Install Tribler
Ensure Tribler is installed on your Ubuntu system. If it’s not already installed, you can download it from the official website (tribler.org) or install it via the terminal:
Download the .deb package from the Tribler website.

Open a terminal and navigate to the download location, then run:
bash

sudo dpkg -i tribler_*.deb

If there are dependency issues, fix them with:
bash

sudo apt-get install -f

Launch Tribler to confirm it’s working:
bash

tribler

Step 2: Disable Brave’s Built-in WebTorrent
Brave has a built-in WebTorrent feature that may intercept magnet links. To disable it:
Open Brave.

Go to Settings (type brave://settings/ in the address bar).

Navigate to Extensions (brave://settings/extensions).

Find the WebTorrent option and toggle it off.

Restart Brave to apply the changes.

Step 3: Set Tribler as the Default Magnet Link Handler in Ubuntu
Ubuntu uses the xdg-mime system to manage file and URI associations. You’ll need to associate the magnet scheme with Tribler:
Open a terminal.

Check the current default handler for magnet links (optional):
bash

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

This will display the current .desktop file associated with magnet links (e.g., transmission-gtk.desktop).

Associate magnet links with Tribler:
bash

xdg-mime default tribler.desktop x-scheme-handler/magnet

Note: The .desktop file for Tribler is typically tribler.desktop. If this doesn’t work, verify the exact name by checking /usr/share/applications/ with:
bash

ls /usr/share/applications/ | grep tribler

If it’s named differently (e.g., org.tribler.desktop), use that instead.

Verify the change:
bash

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

It should now return tribler.desktop.

Step 4: Test in Brave
Open Brave and navigate to a website with a magnet link (e.g., a legal torrent site like an Ubuntu download page).

Click a magnet link.

Brave should now trigger Ubuntu’s xdg-open, which will pass the magnet link to Tribler. Tribler should open and start handling the download.

Troubleshooting
Magnet links still open elsewhere: If another torrent client opens instead, ensure Tribler is set as the default in your Ubuntu system settings:
Go to System Settings > Details > Default Applications (or search for "Default Applications" in your desktop environment).

Check for an option to set Tribler as the default for torrents or manually edit the MIME settings.

No prompt or action: If nothing happens, ensure Tribler’s .desktop file includes the correct MIME type. Open /usr/share/applications/tribler.desktop and verify it has:

MimeType=x-scheme-handler/magnet;application/x-bittorrent;

If not, edit it with:
bash

sudo nano /usr/share/applications/tribler.desktop

Add the MimeType line, save, and update the database:
bash

sudo update-desktop-database

Brave blocks the link: If Brave shows an error (e.g., "blocked by an extension"), disable any interfering extensions via brave://extensions/ and test again.

Notes
Brave itself doesn’t directly manage magnet link associations; it relies on the operating system’s settings. Thus, the key is configuring Ubuntu correctly.

This process should work as of February 28, 2025, assuming Tribler’s installation and .desktop file follow standard conventions.

Let me know if you encounter issues, and I’ll refine the steps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants