shell script to jump or exec an application under X window manager
jump-or-exec tries to see if an application is already running, and if so, bring the application's window to the front, otherwise launch an instance.
Bind it to a shortcut key and it will be useful!
jump-or-exec command [window_name]
This script is written in
You just need to download
jump-or-exec.sh, and put it into your
probably after renaming to
This script uses wmctrl, which is a UNIX/Linux command line tool to interact with an EWMH/NetWM compatible X Window Manager.
This script is based on the version in eshock/.bashrc.d, in which
window_name cannot be omitted.
Besides wmctrl, it is also possible to implement
jump or exec in Xlib directly.
For example, here is a Python script.
The script runs as a daemon, to avoid possible delays when invoking shell script and wmctrl.
The post is written in Chinese, but don't worry, you can read code in Python and code comments in English.
On my machine,
wmctrl is fast enough.
Thus I consider I don't need a persistent daemon.