A known feature in Chromium is the option to make it run in the background, which makes it easier to open .
Is it possible to do the same with firefox (and other applications)?
A known feature in Chromium is the option to make it run in the background, which makes it easier to open .
Is it possible to do the same with firefox (and other applications)?
Running an application in the background
The solution below will allow you to run firefox (or any other application) in the background, meaning: without a visible window. Nor will the application show in Dash as a running application:
If you pick Toggle Firefox however, the application will pop up immediately:
How it works
If the panel icon (indicator) starts up, it launches a new
firefox
window, but immediately hides it (including possible existingfirefox
windows) from the face of the earth, usingxdotool
:This will not only hide the window, but also will hide the fact that
firefox
is running at all, since the unity launcher acts on visibly existing windows.~/.config/hidden_windows
, to be mapped on the next time you choose Toggle Firefox from the menu.The script
How to use
The script needs both
wmctrl
andxdotool
Copy the script into an empty file, save it as
firefox_bg.py
Test_run the script by the command:
If all works fine, add it to Startup Applications: Dash > Startup Applications > Add. Add the command:
Alternatively, copy the code below into an empty file, save it as
firefox_bgrunner.desktop
in~/usr/share/applications
, log out and back in.*The last line,
StartupWMClasss=nonsense
is to make sureFirefox windows will appear under their own icon, not the one of the indicator
.No need to mention that you have to edit the
Exec=
line to reflect the real (absolute) path to where you storedfirefox_bg.py
Then you will have the panel runner available from Dash:
Other applications?
I tested the same procedure with
gnome-terminal
andThunderbird
(the latter usually not the quickest to startup), and it works perfectly:To use with other applications, simply edit the line:
Note however that some applications seem to check if their attempt to create a window succeeded, and create a second one if the first one is unmapped. This happened to me with
Inkscape
.The script can even then perfectly be used though, but would need a small edit. If anyone ever might need to use it with
Inkscape
, please leave a comment.I'd like to propose a 2019 solution to this for Ubuntu 18-19+ with GNOME that is a little bit simpler (IMO) and uses bash instead of python for simplicity. I made this so that Firefox would ask for my Master Password when I signed in, but then not ask again unless I went to view passwords. I was tired of it popping up every time I started firefox.
First install the dependencies:
Then put this script somewhere, say
/data/system/bin/firefox-background
:And:
Now you can run this script however you would like such as from a terminal window or from the GNOME startup with a file in
.config/autostart/FirefoxBackground.desktop
:After that, you'll get a popup for the master password once, and never again unless you intend to access secure info.