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
galternatives(afaik not available in Gentoo) or
- Editing the
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
$ 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.
Since then Gwibber is opening links in Chromium.
About the author
Jan Beilicke is a long-time IT professional and full-time nerd. Open source enthusiast, advocating security and privacy. Sees the cloud as other people's computers. Find him on Mastodon.