My default browser is Firefox, but when I click on a link "visit homepage" inside synaptic it opens the link in Chrome instead.

How do I make it open links in the default browser instead?


The solution appears to be described in this post on the thread, synaptic failed to execute default web browser. Input/output error (note that I have modified the links to give clearer contexts and fixed the third broken link):

within synaptic, onClick handler for the homepage link is RGPkgDetailsWindow::cbOpenHomepage() (see rgpkgdetails.cc - Line 201) which calls GetBrowserCommand() (see rgutils.cc - Line 114) and invokes /usr/bin/xdg-open (it is an easily patched shell script) (see xdg-open.in - Line 432)

if [ -n "$BROWSER" ]; then
    open_envvar "$1"
fi

Patching here will guard against anything routed through xdg-open (not just synaptic)

if [ -n "$BROWSER" ]; then
    if [[ $EUID -eq 0 ]]; then
        open_envvar "su -c ${SUDO_USER} $1"
    else
        open_envvar "$1"
    fi
fi

The reason behind this is nicely described by this post on the same thread:

The mystery of the observation your are facing is due to security settings and different users involved.

Background: When you start synaptic, the GUI-app is run as user root. The problem: When you click on a link to open a web-browser, synaptic forwards the call to open a webbrowser as user root. This has certain system-security and stability related implications.

Further : Synaptic can be started in different ways to run as user root, those different calls do have different system-security related constrains. (It can be called either via pkexec, gksu or gksudo, depending how the synaptic call is initiated, e.g from the menu, from MX-updater or something else.) Setting the default browser, within preferred applications or the through the debians alternative mechanism, is not sorting the issue provided by those security-constrains.

Summary: As it is now the simplest way would be the copy the link and open the browser manually. This needs to get further considerations to provide a stable and secure way of calling from a GUI-app (running as user root) the users web-browser within the user environment.

This is probably worth noting that the patch could be further modified, as per the final post:

Nice idea to "secure" xdg-open a bit, probaly also worth to check it for all types of root-app invocations like, su-to-root, gksu, gksudo and pkexec, as we have f.i. in the menu a synapic-pkexec call.