xdg-mime is the tool

I've noticed that when using xmonad, or any other WM that doesn't provide a default configuration interface for applications (minimal WM's), there is a problem with opening weblinks from programs (terminal apps and communications apps, for example).

I first noticed this problem when opening links out of telegram, they would open in firefox, despite setting BROWSER in my env.

Many programs use a common interface called xdg.

However, simply applying the solution of setting the default browser as described in this post is not enough: it's also necessary to set the default scheme handler for the links themselves, as such:

browser=org.qutebrowser.qutebrowser.desktop
xdg-mime default $browser x-scheme-handler/https
xdg-mime default $browser x-scheme-handler/http

Now, applications happily use the preferred browser for new links.