Is there something similar to quake mode in tilix for Firefox?

I want to switch to any already running instance of firefox (or maybe open a new one if not present already) using a shortcut like F12 or F11.


I do not know of a "native" way to assign a shortcut in order to switch to an existing window. It could be done with a script involving wmctrl. However, I am using a little tool jumpapp at https://github.com/mkropat/jumpapp, which uses wmctrl behind the screen.

Using wmctrl

wmctrl is not installed by default, so install it using sudo apt install wmctrl.

Following one-liner will switch to Firefox, or launch it if no window currently is open:

wmctrl -xa Firefox || firefox

In Bash shell, the command separator || means: if the first command was not successful, then try the next one. Thus, the first command wmctrl attempts to activate a window of WM_CLASS Firefox. Only if no such window is found, which implies Firefox is not running, the command after the separator is launched, i.e., starting the Firefox browser.

To find the WM_CLASS of a window to use in the wmctrl command, use

wmctrl -lx

The option x will add a column showing the window class, as in

0x04400003  0 Navigator.Firefox     hostname keyboard - Is there a way to bind shortcut keys to switch to already open applications in Ubuntu 18.04 LTS? - Ask Ubuntu - Mozilla Firefox

The third entry, Navigator.Firefox shows we can use Firefox as the window class to identify the window. Using a tool jumpapp

Where using wmctrl directly is not quite complicated, a tool jumpapp is even more simple in use, and has a few added benefits:

  • It is even simpler to implement.
  • If multiple windows of the same application are open, subsequent presses on your shortcut key will cycle through them.
  • It has some more command line options to tweak your experience. As such, you can assign a second key combination to cycle backwards through open windows, or you can have a keypress toggle between bringing the window forward and minimizing it.

jumpapp is not in the repositories, but can conveniently be installed as a .deb following the instructions on the website:

sudo apt-get install build-essential debhelper pandoc shunit2
git clone https://github.com/mkropat/jumpapp.git
cd jumpapp
make deb
sudo dpkg -i jumpapp*all.deb
sudo apt-get install -f # if there were missing dependencies

Once jumpapp is installed, simply precede the command to launch your application by jumpapp to launch your application launched if it is not running already, or switch to an existing window. Assign that command to a shortcut key.

You can also edit the "Exec=" line in a .desktop file, to provide the same functionality to a launcher. As a matter of fact, a command jumpappify-desktop-entry is included that will do that automatically for a .desktop file you specify.

Launchers in Gnome Shell already behave like this by default, but in other desktops, the app can be used to provide similar "launch or switch-to" functionality to launchers.

  • What advantage does jumpapp offer over wmctrl? – Justice for Monica Nov 8 at 9:08
  • This works! Thank you :D – vadasambar Nov 8 at 10:30
  • @DKBose Convenience. Just a "jumpapp gnome-terminal" rather than having to brew your own little script. – vanadium Nov 8 at 12:37
  • In Kubuntu, I have keyboard shortcuts like wmctrl -xa Kate || kate, wmctrl -xa Konsole || konsole, wmctrl -xa Dolphin || LANG=en_GB.utf8 dolphin, wmctrl -xa Geany || geany, wmctrl -xa Firefox || firefox, wmctrl -xa google-chrome || google-chrome-stable --enable-features=WebUIDarkMode --force-dark-mode --profile-directory=Default --start-maximized, etc. – Justice for Monica Nov 8 at 12:51
  • Indeed also very simple and fully adequate for assigning a shortcut. However, you need to correctly identify the Window class, so this is another slight advantage of jumpapp..As I mentioned wmctrl, I can also add this f to be more complete. – vanadium Nov 8 at 13:40

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.