Module gabelstaplerwm::wm::util [] [src]

General design concepts behind the macros

All macros to be passed to bind! share a common property: they allow for outputting (almost) arbitrary data after successful execution and before control is returned to the window manager's core.

This can be achieved in two ways, which are easier to demonstrate than to explain properly:

This returns a closure that pushes tagset zero and calls the closure on the client list and tag stack container to generate some object and print it to stdout:

push_tagset!(0;; |c, s| ...)

This returns a closure that pushes tagset zero and prints some previously computed value or values to stdout: push_tagset!(0; some_value) push_tagset!(0; some_value; some_more_values_here)

These methods are different because the former allows to compute the output after the "real work" has been done by the callback closure generated from the macro, whereas the latter is more readable, but doesn't allow to do that. Note that in the case of multiple objects passed to the second form, they are printed on separate lines.

Another thing to remember: if the closure accepts multiple arguments, they are comma-separated and come before the semicolon(s), like so:

some_macro!(param_1, param_2, ... , param_n; optional_output(s)/whatever)