Rule Based Window Placement (StumpWM Manual)

### 5.5 Rule Based Window Placement ¶

Macro: define-frame-preference target-group &body frame-rules ¶

  Create a rule that matches windows and automatically places them in a specified group and frame or converts them to floating windows. Each frame rule is a lambda list:

      (frame-number raise lock &key from-group create restore dump-name class class-not
      instance instance-not type type-not role role-not title title-not
      match-properties-and-function match-properties-or-function)

  target-group

    When nil, rule applies in the current group. When non nil, lock determines applicability of rule

  frame-number

    The frame number to send matching windows to. If set to :float instead of a frame number, the window will be converted to a floating window. This is convenient for applications that should be launched as pop-ups.

  raise

    When non-nil, raise and focus the window in its frame

  lock

    When this is nil, this rule will only match when target-group matches the group designated by from-group. When non-nil, this rule matches regardless of the group and the window is sent to target-group. If lock and raise are both non-nil, then stumpwm will jump to the specified group and focus the matched window.

  from-group

    When lock is NIL, and this is non-NIL, this rule will only match when target-group matches from-group. This should be set to either a group name(a string), or an expression that returns a group(e.g (current-group)). When this is NIL, the rule matches if target-group matches the group the window is in, or the current group if the window has no group.

  create

    When non-NIL the group is created and eventually restored when the value of create is a group dump filename in *DATA-DIR*. Defaults to NIL.

  restore

    When non-NIL the group is restored even if it already exists. This arg should be set to the dump filename to use for forced restore. Defaults to NIL

  class

    The windows class must match class.

  class-not

    The windows class must not match class-not

  instance

    The windows instance/resource name must match instance.

  instance-not

    The windows instance/resource name must not match instance-not.

  type

    The windows type must match type.

  type-not

    The windows type must not match type-not.

  role

    The windows role must match role.

  role-not

    The windows role must not match role-not.

  title

    The windows title must match title.

  title-not

    The windows title must not match title-not.

  match-properties-and-function

    A function that, if provided, must return true alongside the provided properties in order for the rule to match. This function takes one argument, the window. Must be an unquoted symbol to be looked up at runtime.

  match-properties-or-function

    A function that, if provided and returning true, will cause the rule to match regardless of whether the window properties match. Takes one argument, the window. Must be an unquoted symbol to be looked up at runtime.

Function: clear-window-placement-rules ¶

  Clear all window placement rules.

Command: remember lock title ¶

  Make a generic placement rule for the current window. Might be too specific/not specific enough!

Command: forget ¶

  Forget the window placement rule that matches the current window.

Command: dump-window-placement-rules file ¶

  Dump *window-placement-rules* to FILE.

Command: restore-window-placement-rules file ¶

  Restore *window-placement-rules* from FILE.

Variable: *window-placement-rules* ¶

  List of rules governing window placement. Use define-frame-preference to add rules