criteria: add view-only matcher for swallows

The swallow walker matches against a view that has not yet been
attached to a container. Factor the view-intrinsic checks out of
criteria_matches_view and expose them as
criteria_matches_view_unmapped.
This commit is contained in:
codegax 2026-04-26 11:30:00 -06:00
parent 850e50b9b7
commit 83d6fef24e
2 changed files with 51 additions and 20 deletions

View file

@ -83,6 +83,18 @@ struct criteria *criteria_parse(char *raw, char **error);
*/
list_t *criteria_for_view(struct sway_view *view, enum criteria_type types);
/**
* Match a criteria against a view without requiring view->container to be
* set. Used by append_layout's swallow matching, which runs before a view
* is attached to a container in the tree. Only view-intrinsic fields are
* considered: title, shell, app_id, sandbox_*, tag, pid, and (when xwayland
* is enabled) class, instance, window_role, window_type, X11 id. Criteria
* fields that depend on container state (con_mark, con_id, floating, tiling,
* workspace, urgent) are ignored.
*/
bool criteria_matches_view_unmapped(struct criteria *criteria,
struct sway_view *view);
/**
* Compile a list of containers matching the given criteria.
*/