The GNOME Control Center allows me to select a web browser under Details » Default Applications. However, only browsers installed via the package manager can be selected there. How can I specify an arbitrary executable to be run whenever a GNOME application wants to start a web browser?

The background of my question is that every time I click on a link in some GNOME application I want to select in which of my different Firefox profiles the respective web page is opened. Firefox doesn’t support this; it only allows you to select a profile when no Firefox instances are already running. Therefore I’ve written a small wrapper script that provides this feature, and I want GNOME applications to run this wrapper script instead of running Firefox directly.

I’m using Ubuntu GNOME 16.04.

  • This could be an XY problem. What do you really want, where you now think you need new firefox profiles for? Indicate your real problem, i.e., what is your ultimate goal, instead of fixing on the firefox profiles. You may then obtain suggestions for other, perhaps more valuable approaches. – vanadium Mar 2 '19 at 8:39
  • 1
    Given that I have more than 30 years of experience with solving IT problems, I think I’ve analyzed my underlying problem well enough and my solution to it, which involves explicit choice of Firefox profiles, is a sensible one. I’ve asked a specific question about the default browser setting in GNOME and would appreciate an answer that specifically addresses this question. – Wolfgang Jeltsch Mar 2 '19 at 21:35

I would do it via the menu editor normally present by default on Ubuntu. If you don't have it then you can install menulibre from ubuntu repository.

Select the launcher of your default web browser and replace the standard command with the path to your script:

enter image description here

  • Would that change which applications are available as default web browsers, or would it only change menu entries? – Wolfgang Jeltsch Mar 2 '19 at 21:20
  • 1
    @WolfgangJeltsch it changes the .desktop files stored in ~/.local/share/applications, which are used by the desktop environment to determine what "shortcut" corresponds to each application. – RolandiXor Mar 2 '19 at 21:37
  • 2
    Ah, thanks for the info. Meanwhile I manually added a modified version of firefox.desktop that refers to my wrapper script to ~/.local/share/applications. Consequently I can select my wrapper script via the “Activities” program selector. However, I still can only select the ordinary Firefox and Chromium as the default browser in the control center. – Wolfgang Jeltsch Mar 2 '19 at 22:12

I had the same problem. Create a new .desktop file with a distinctive "Name"-field and save it as suggested in ~/.local/share/applications. Then change via xdg-settings set default-web-browser the default browser:

xdg-settings set default-web-browser firefox-private.desktop

After the command you have a new entry in Gnome Settings. But after changing the default browser, my Gnome Settings forgets the custom entry again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.