aboutsummaryrefslogtreecommitdiffstats

A script that switches between windows matching the same window class. If no such window can be found, treat the rest of the command line as the command to start.

Requirements

This script depends on scsh, herbstluftwm, wmctrl, and hlwm-switch-to-window.

Installation

Put the hlwm-run-or-raise script anywhere in your $PATH.

Usage

Call the hlwm-run-or-raise script with 2 or more arguments:

class
The first argument is the class of the window to look for. This is a regular expression, so that multiple classes can be specified at once. This is matched against the WM_CLASS window property (see the output of xprop).
command
Any other command-line arguments are used to start the program that should create a window with the given class.

Examples

This call will switch between any windows with the class “Emacs”, or start the program emacsclient --create-frame if no windows with that class can be found.

hlwm-run-or-raise Emacs emacsclient --create-frame

This call will switch between windows with any of the classes “URxvt”, “Hyper”, or “kitty”. If no window with any of those classes is found, the program kitty is called to create one.

hlwm-run-or-raise "\(URxvt\|Hyper\|kitty\)" kitty