aboutsummaryrefslogtreecommitdiffstats
path: root/README.org
blob: 052905c4afef8c82a79368136e32d65feb4d04fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#+title: Run-or-raise for Herbstluftwm
#+options: toc:nil num:nil

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 [[https://scsh.net/][scsh]], [[https://herbstluftwm.org/][herbstluftwm]], [[http://tripie.sweb.cz/utils/wmctrl/][wmctrl]], and [[https://code.ryuslash.org/util/tom/hlwm-switch-to-window/][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