google chrome. linux. XDG-OPEN keep asking me (forever) what to do with magnet links
(i'm on latest chrome beta (64) but it is happening in all the previous version of chrome i used.)
when i press magnet links in google chrome, i get this card: Open xdg-open?
so i mark to always open these types of links... and then press open xdg-open. now qBittorrent is starting to work. everything is OK.
but, if i press another magnet link, it again pop up this card and ask me what to do. it always do that and never save what i choose for later.
i have qbittorrent.desktop
in /usr/share/applications
the beginning of qbittorrent.desktop
is:
[Desktop Entry]
Categories=Network;FileTransfer;P2P;Qt;
Exec=qbittorrent %U
GenericName=BitTorrent client
Comment=Download and share files over BitTorrent
Icon=qbittorrent
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Name=qBittorrent
Terminal=false
Type=Application
StartupNotify=false
StartupWMClass=qbittorrent
Keywords=bittorrent;torrent;magnet;download;p2p;
also in ~/.config/mimeapps.list
i have this:
[Default Applications]
text/html=google-chrome-beta.desktop
x-scheme-handler/http=google-chrome-beta.desktop
x-scheme-handler/https=google-chrome-beta.desktop
x-scheme-handler/about=google-chrome-beta.desktop
x-scheme-handler/unknown=google-chrome-beta.desktop
x-scheme-handler/magnet=qbittorrent.desktop
if i command xdg-mime query default x-scheme-handler/magnet
i get qbittorrent.desktop
result.
also if i command: xdg-mime default qbittorrent.desktop x-scheme-handler/magnet
nothing is changed and problem exist.
last thing, if i open terminal and command:
xdg-open magnet:?xt=magnet-link-continue-here
it opens qbittorrent with the link without a problem.
it was a bug in chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=788431
fixed now on latest chrome beta (maybe on stable also).
This solution works for me on Google Chrome 84.0.4147.89, for specific types of xdg links. For example, if the link in question is whatsapp://someurl
, you can use:
sudo mkdir -p /etc/opt/chrome/policies/managed/ && echo '{ "URLWhitelist": ["magnet://*"] }' |sudo tee /etc/opt/chrome/policies/managed/whitelist.json