Fixing default browser bug in GNOME vs KDE
I found there are slight differences in how GNOME and KDE handle the default browser for URLs.
In this case, I had cloned the Firefox .desktop file and (probably by my mistake) the section [Desktop Action new-private-window] was above [Desktop Entry]. This worked fine in KDE, but didn’t work for GNOME nor for Flatpaks.
One way to observe this was:
$ gio mime x-scheme-handler/https firefox-2.desktop gio: Failed to load info for handler "firefox-2.desktop"
The solution was simple, [Desktop Entry] must come before [Desktop Action new-private-window].
You can confirm that the right browser is now set using gio open https://google.com.