[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 consisely-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))

Command: move-windows-to-group windows &optional (arggroup nil)

Move all windows from the list to the group

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

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.

Command: pull-w w &optional g

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

Command: titled-p w title

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

Command: title-re-p w tre

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

Command: classed-p w class

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

Command: class-re-p w cre

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

Command: typed-p w type

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

Command: type-re-p w tre

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

Command: roled-p w role

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

Command: role-re-p w rre

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

Command: resed-p w res

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

Command: res-re-p w rre

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

Command: grouped-p w &optional name

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

Command: in-frame-p w &optional f

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


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on January 28, 2024 using texi2html 1.82.