I've written a small program called jumpapp
for exactly this purpose. It lets you use one command to opens a new application the first time you run it, and to switch to the already open window any time you run it after that. As a bonus, if you have multiple windows open for the application, repeatedly running the command will cycle through all the application's windows.
Usage: jumpapp [OPTION]... COMMAND [ARG]...
Jump to (focus) the first open window for an application, if it's running.
Otherwise, launch COMMAND (with opitonal ARGs) to start the application.
Under-the-hood, jumpapp
locates application windows using two methods: 1) it gets all running pids for COMMAND and looks for windows with a matching _NET_WM_PID
, and 2) it looks for windows with a WM_CLASS
that matches COMMAND.
If you want to try it out, it's easy to install from source, or you can install it from my PPA:
sudo add-apt-repository ppa:mkropat/ppa
sudo apt-get update
sudo apt-get install jumpapp
Best Answer
There's a few ways: