❮ zur Übersicht

One firefox for two X servers

  • Autor:
  • Datum: 20.01.2011

Like a lot of it-staff nowadays, I’ve got two displays connected to my Linux Box. Most of my colleagues like having one big workspace using Xinerama / TwinView, but I prefer 2 independent workspaces, even if I can’t use drag and drop between them.

Since I’m using that layout for years, I rarely run in problems, but today I faced a problem. Currently I use a graphical IRC Client called quassel, which is running on my right Display. My firefox is running on the left display, and due to “poor” default settings of Ubuntu, clicking a link within quassel fires up konqueror on my right display, instead of handing it over to the Firefox.

Following the “Ubuntu” way, I did update-alternatives --config x-www-browser to update the browser settings of my machine to firefox.

This fixed the starting of konqueror, so after clicking on a link in quassel, firefox gets invoked, and presents the Error “Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.”, which in this case simply means that there’s already a Firefox running on the other display.

So, firefox needs help to find itself. After checking how my X server labels my left display (:0.1) by executing echo $DISPLAY in a shell, and checking Firefox startup options, it seemed clear that adding --display=:0.1 to firefox startup, will fix the issue.

So I created a small script in my homedir ‘~/bin/firefox’, #!/bin/bash /usr/bin/firefox --display=:0.1 "$@", and added the dir ‘~/bin/’ to my PATH environment variable, restarted the corresponding shell, and failed.

Why? When I call ‘firefox’ from my shells, ~/bin/firefox gets executed, but quassel still starts /usr/bin/x-www-browser, which was set by update-alternatives --config x-www-browser.

So I added my personal script, to the alternatives list by update-alternatives --install /usr/bin/x-www-browser x-www-browser /home/ferstl/bin/firefox 110. As you’ve may spotted, I gave my version of the start script an priority of 110, so it’s usually chosen over konqueror by automated configuration. After performing another update-alternatives --config x-www-browser and choosing my script, clicking links in quassel worked.

Due to update-alternatives setting system wide configuration for all users, I added a problem for other users on my machine. That could be fixed by checking for my user in the startup script, but usually I’m the only one using this computer, so that’s not a big issue.

Tags: firefox linux ubuntu