### 5.6 Window Selection Expressions ¶

Window Selection Expressions (WSE) were inspired by SQL. The intent is to allow writing consise code to select the windows you need and to act upon them (or just to get the list of selected windows). The implementation includes a set of (hopefully) consistent concisely-named wrappers for the StumpWM functionality useful for window set description and the act-on-matching-windows macro that encapsulates the logic of iterating over a window set.

If we had SQL in StumpWM, we would write `select window_id from windows as w where w.title = 'XTerm'`. WSE chooses to be more Lisp-style and instead uses `(act-on-matching-windows (w) (titled-p w "XTerm") w)`

The `act-on-matching-windows` function also allows performing some actions, for example getting all the windows titled XTerm into the current group: `(act-on-matching-windows (w) (titled-p w "XTerm") (pull-w w))`

Function: move-windows-to-group windows &optional arggroup ¶

  Default Values:

        arggroup  nil

  Move all windows from the list to the group

Macro: act-on-matching-windows (var &optional range) condition &rest code ¶

  Default Values:

        range  '(stumpwm:current-screen)

  Run code on all windows matching condition; var is the shared lambda variable. Range can be any screen/group/frame or :screen/:group/:frame for the current instance. Condition is just the code to evaluate.

Function: pull-w w &optional g ¶

  Default Values:

        g  nil

  Pull the window w: to the current group or to the specified group g.

Function: titled-p w title ¶

  Check whether window title of the window w is equal to the string title.

Function: title-re-p w tre ¶

  Check whether the window title of the window w matches the regular expression tre.

Function: classed-p w class ¶

  Check whether the window class of the window w is equal to the string class.

Function: class-re-p w cre ¶

  Check whether the window class of the window w matches the regular expression cre.

Function: typed-p w type ¶

  Check whether the window type of the window w is equal to the string type.

Function: type-re-p w tre ¶

  Check whether the window type of the window w matches the regular expression tre.

Function: roled-p w role ¶

  Check whether the window role of the window w is equal to the string role.

Function: role-re-p w rre ¶

  Check whether the window role of the window w matches the regular expression rre.

Function: resed-p w res ¶

  Check whether the window resource of the window w is equal to the string res.

Function: res-re-p w rre ¶

  Check whether the window resource of the window w matches the regular expression rre.

Function: grouped-p w &optional name ¶

  Default Values:

        name  nil

  Check whether the window w belongs to the group name or the current group if name is not specified.

Function: in-frame-p w &optional f ¶

  Default Values:

        f  nil

  Check whether the window w belongs to the frame f or to the current frame if the frame is not specified.