Next: , Previous: , Up: Windows   [Contents][Index]


8.16 Window Rules by Matching

Sawfish can trigger actions particular to each window. More precisely, if the window’s properties match to the user set rule, then it is executed when the window appears. Check is done in before-add-window-hook. (see Standard Hooks)

These rules can easily be set by configurater GUI, but there’re functions to manipulate them. They’re defined in sawfish.wm.ext.match-window.

Function: add-window-matcher rules actions

Let us see an example first:

(add-window-matcher '((WM_NAME . "^root$")
                      (WM_CLASS . "^XTerm/xterm$"))
                    '((ignore-program-position . t)
                      (maximize . vertical)))

rules is an alist, and each value is matched using regex. Allowed keys are any of WM_NAME, WM_CLASS, WM_ICON_NAME, WM_WINDOW_ROLE, WM_CLIENT_MACHINE, WM_COMMAND, and WM_LOCALE_NAME. Values to the keys are strings. Windows are selected if all of these rules match.

actions is an alist. For possible keys and values, see lisp/sawfish/wm/ext/match-window.jl.

Check for invalid arguments are not done.

Function: remove-window-matcher rules props

Opposite of add-window-matcher, but unlike it, props are list of properties. Example:

(remove-window-matcher '((WM_NAME . "^root$"))
                       '(place-mode ignore-program-position))

The best place to use add-window-matcher is in ~/.sawfish/rc. It’s because rules modified by these commands are not necessarily saved, depending on how you run the configurator.

The rules are stored in variable match-window-profile. Use the above functions to modify its value. It is not recommended to directly manipulate it.