In my particular use case I wanted links in Gwibber to open in Chromium instead of Firefox. Gwibber is a Twitter client written in Python. Unfortunately all the proposed solutions from above didn’t work. Fortunately I found a solution.
There are lots of articles in the web dealing with the right way to set the default web browser in Gnome or the system in general:
Gnome panel: “System information > Preferred Applications” or
When I tried to open an URL in the Python Shell, the page opened in Firefox:
>>> import webbrowser
>>> webbrowser.open(’http://heise.de’) # Opened in Firefox
I set the environment variable $BROWSER:
$ export BROWSER=“chromium”
When I ran the Python code again the page opened in Chromium. So far so good, but of course it was still not working in Gwibber. I tried to set it automatically by storing the variable in .bashrc - no luck.
Eventually I found out that I should set the variable in the file ~/.pam_environment: It is a storage for environment variables - session-wide used, even when running a desktop environment. After editing the file I had to logout of my current graphical session and login again.