Namespaces | |
| namespace | detail |
Classes | |
| struct | ContextRemap |
| How the desktops and activities a rule set names have moved. More... | |
Enumerations | |
| enum class | ContextAxis { CatchAll , Monitor , Desktop , Activity , Combined } |
| The cascade axis a context tuple resolves to. More... | |
Functions | |
| ContextAxis | contextAxisOf (const QString &screenId, int virtualDesktop, const QString &activity) |
| Classify a (screen, desktop, activity) tuple into its cascade axis. | |
| QString | contextRuleName (const QString &screenId, int virtualDesktop, const QString &activity) |
| Human-readable label for a context rule's tuple. | |
| QUuid | assignmentRuleIdFor (const QString &screenId, int virtualDesktop, const QString &activity) |
| The deterministic v5 rule id makeAssignmentRule would assign for a given (screen, desktop, activity) tuple. | |
| QUuid | disableRuleIdFor (const QString &screenId, int virtualDesktop, const QString &activity, const QString &modeToken) |
| The deterministic v5 rule id makeDisableRule would assign for a given (screen, desktop, activity, modeToken) tuple. | |
| MatchExpression | makeContextMatch (const QString &screenId, int virtualDesktop, const QString &activity) |
| Build the context-only MatchExpression for a (screen, desktop, activity) tuple. | |
| QList< RuleAction > | makeAssignmentActions (const QString &modeToken, const QString &snappingLayout, const QString &tilingAlgorithm, const QString &scrollingTemplate) |
| Build the lossless action list for a migrated zone Assignment. | |
| Rule | makeAssignmentRule (const QString &name, const QString &screenId, int virtualDesktop, const QString &activity, const QString &modeToken, const QString &snappingLayout, const QString &tilingAlgorithm, int priority, const QString &scrollingTemplate) |
| Build a complete migrated zone-Assignment Rule. | |
| Rule | makeDisableRule (const QString &name, const QString &screenId, int virtualDesktop, const QString &activity, const QString &modeToken, int priority) |
| Build a DisableEngine context rule for a per-mode disable entry. | |
| bool | isContextEqualsLeaf (const MatchExpression &expr, Field field) |
True if expr is an exact Field == value equality leaf for field. | |
| bool | contextDimsOf (const MatchExpression &match, QString &screenId, int &virtualDesktop, QString &activity) |
| Decompose a context rule's match into its pinned dimensions. | |
| bool | pinsNonDimensionContextField (const MatchExpression &match) |
True if match pins a context field that is NOT one of the three cascade dimensions — any context field outside kContextDimensionFields (Mode, TiledWindowCount, the screen orientation, width, height and aspect ratio, ActiveLayout, ColorScheme). | |
| ContextAxis | contextAxisFor (const MatchExpression &match) |
Classify match's pinned-dimension shape as a ContextAxis. | |
| bool | matchIsExactContextBase (const MatchExpression &match) |
True if match is a context-only "screen-only" pin — screen present, no desktop, no activity. | |
| bool | matchIsExactContextDesktop (const MatchExpression &match) |
True if match is a context-only "screen + desktop" pin (no activity). | |
| bool | matchIsExactContextActivity (const MatchExpression &match) |
BROAD per-activity family classifier — true if match is a context-only rule pinning an activity (with screen), whether or not it ALSO pins a desktop. | |
| bool | matchIsExactContextActivityStrict (const MatchExpression &match) |
| STRICT per-activity classifier — screen+activity ONLY, no desktop pin. | |
| bool | matchIsExactContextCombined (const MatchExpression &match) |
| STRICT Combined classifier — screen + desktop + activity all pinned. | |
| bool | matchIsExactContext (const MatchExpression &match, const QString &screenId, int virtualDesktop, const QString &activity) |
True if match is the exact-shape context for screenId / virtualDesktop / activity — i.e. | |
| std::optional< QString > | disableRuleMode (const Rule &rule) |
If rule is a per-mode disable rule, return its mode wire token verbatim; otherwise nullopt. | |
| std::optional< QList< Rule > > | remapContextRules (const QList< Rule > &rules, const ContextRemap &remap) |
rules with the desktops and activities they name moved by remap. | |
Variables | |
| constexpr int | kContextBandBase = 300 |
| Default precedence band base for context rules (zone assignments and per-mode disables). | |
| constexpr Field | kContextDimensionFields [] = {Field::ScreenId, Field::VirtualDesktop, Field::Activity} |
| The three cascade dimensions makeContextMatch can emit — the only context fields contextDimsOf decodes back out of a match. | |
|
strong |
The cascade axis a context tuple resolves to.
The four shapes the context bridge produces — Combined is the screen + desktop + activity exact pin, Activity is screen + activity, Desktop is screen + desktop, Monitor is screen-only. A catch-all or a tuple with an empty screenId returns CatchAll and is not a pinned axis. Callers that need to compare rule families (per-mode disable lists, the per-screen / per-desktop / per-activity batch setters) discriminate on this enum so the formula lives in one place.
|
inline |
The deterministic v5 rule id makeAssignmentRule would assign for a given (screen, desktop, activity) tuple.
Exposing the id derivation as a public helper lets callers look up a stored assignment rule by deterministic id derivation rather than evaluating each rule's match shape — RuleSet::ruleById itself is still a linear scan, but the per-rule comparison collapses to a single QUuid equality instead of a tuple-shape predicate. Two callers deriving the same tuple necessarily land on the same id, so the lookup stays correct across processes and across persistence round-trips.
|
inline |
Classify match's pinned-dimension shape as a ContextAxis.
A non-context-only match (one carrying a window-property leaf) returns CatchAll, and so does a context-only match that pins a non-dimension context field (e.g. TiledWindowCount) — callers that need to distinguish a window-property rule from a true catch-all must combine this with match.isContextOnly().
|
inline |
Classify a (screen, desktop, activity) tuple into its cascade axis.
The classifier keys only on which of the three dimensions are present — it does NOT distinguish empty-vs-missing in the dimensional sense. The axes remain the batch reader/writer families; they no longer drive any priority.
|
inline |
Decompose a context rule's match into its pinned dimensions.
screenId / virtualDesktop / activity are reset, then filled from whichever ScreenId / VirtualDesktop / Activity equality leaves the match carries. An empty catch-all leaves all three at their defaults and returns true. Window-property leaves (AppId etc.) are ignored — only context fields are read, so a mixed flat rule still yields its context projection. When no context-equality leaf was found (e.g. an All{} of only window-property leaves), the function returns false; the empty catch-all remains the only success case with all-default outputs.
Contract — this is strictly the inverse of makeContextMatch, so it only understands the shapes that helper produces: an empty catch-all, a single context-equality leaf, or a flat All{} whose children are context-equality leaves. It walks one level of children; a nested composite (All{ Any{...} }) is not a context rule this bridge authored and decomposing it would be silently lossy. Such an input is left as all-defaults — callers that build their own deeper match expressions must not route them through this readback.
A duplicate context-dimension leaf under the same flat All{} (e.g. two ScreenId Equals leaves) is refused rather than silently coerced via last-write-wins: makeContextMatch can never produce duplicates, so a duplicate is undefined input. The dims are reset to defaults and the function returns false; a successful decomposition returns true. Most callers ignore the return — falling back to all-defaults is the safe "not a context rule we authored" treatment.
|
inline |
Human-readable label for a context rule's tuple.
The single canonical formula for the " · Desktop N" / " · Activity" suffix — every caller that needs to log or display a context-rule identity routes through here so the string shape stays consistent across the daemon, settings UI, and migration code.
|
inline |
The deterministic v5 rule id makeDisableRule would assign for a given (screen, desktop, activity, modeToken) tuple.
The disable rule's id includes the engine the rule disables — different engines' disables for the same context are distinct rules, so the id helper mirrors that distinction. modeToken is the wire string for the engine (e.g. "snapping" / "autotile" / "scrolling") — supplying it as a token (not a bool) means a future engine extends the identity key namespace without rewriting existing UUIDs (the "disable-snapping" and "disable-autotile" identity keys are preserved verbatim, so every rule already on disk keeps its id).
|
inline |
If rule is a per-mode disable rule, return its mode wire token verbatim; otherwise nullopt.
A rule qualifies iff exactly one of its actions is a DisableEngine action and that action's mode param is a non-empty wire token. The exactly-one rule is enforced: a second DisableEngine action makes the rule ambiguous — it is not a bridge-authored disable rule — so the function bails to nullopt. An empty token is treated as a malformed payload and also returns nullopt.
Open-vocabulary within the bridge itself. At persistence boundaries the DisableEngine action descriptor's load-time validator already enforces the closed engineModeOptions() set (see ruleaction_builtins_p.h), so a rule that survived load has a vocabulary-valid token. The bridge keeps the verbatim contract so an in-memory caller building a rule programmatically — or a test pinning the bridge's unrecognised-token behaviour — can carry any non-empty token without coupling PhosphorRules to PhosphorZones, and so a future mode addition round-trips through the bridge without a coordinated edit.
|
inline |
True if expr is an exact Field == value equality leaf for field.
|
inline |
Build the lossless action list for a migrated zone Assignment.
The AssignmentEntry invariant is mode-toggle losslessness: it stores snappingLayout, tilingAlgorithm and scrollingTemplateLayout so flipping mode never drops the other fields. The migrated rule therefore carries up to four actions:
snappingLayout is non-empty (the action descriptor rejects an empty layoutId).tilingAlgorithm is non-empty (the descriptor rejects an empty algorithm).scrollingTemplate is non-empty (same layoutId wire KEY as SetSnappingLayout, but a native scrolling-template uuid — the two id namespaces are disjoint).A mode-only entry (all three payload fields empty — the KCM "autotile, default algorithm" shape) yields a single SetEngineMode action; the mode token alone preserves the user's intent.
Open-vocabulary by design: the SetEngineMode descriptor's validator checks only that modeToken is non-empty — vocabulary validation lives at consumers via PhosphorZones::modeFromWireString, NOT at load time. Settings routes PhosphorZones::Mode → QString via modeToWireString (the authoritative mapping), so a production caller never produces an unrecognised token. An empty token writes a malformed rule that load does reject (the validator's non-empty check fires there). An unknown token like "bogus" survives load and is silently inert at consumption: the assignment-side consumer PhosphorZones::RuleHelpers:: entryFromRuleMatchActions decodes via modeFromWireString, which returns nullopt for unknown tokens and leaves the entry on its Snapping default. Every token the validator accepts — today snapping/autotile/scrolling, see engineModeOptions() in ruleaction_builtins_p.h — round-trips end-to-end through the consumer.
|
inline |
Build a complete migrated zone-Assignment Rule.
The match is context-only; the actions are the lossless assignment set from makeAssignmentActions. name is a human-readable label for the settings UI. modeToken is the wire string for the assignment's mode (see makeAssignmentActions for vocabulary contract). priority is the rule's precedence verbatim — the caller owns it (highest priority wins per slot, ties by list order). scrollingTemplate defers entirely to makeAssignmentActions, which emits the SetScrollingTemplate action only for a non-empty id. It sits after priority rather than beside the other two payload fields so the pre-scrolling parameter order stays put and every call site only appends an argument.
|
inline |
Build the context-only MatchExpression for a (screen, desktop, activity) tuple.
Pins only the non-default dimensions: a non-empty screenId, a virtualDesktop > 0, a non-empty activity. A tuple that pins nothing yields the empty-All{} catch-all match.
|
inline |
Build a DisableEngine context rule for a per-mode disable entry.
Per-mode disable lists ("snapping is off on monitor X") become context rules carrying a single DisableEngine action. modeToken records which engine the rule disables (the wire string, e.g. "snapping" / "autotile" / "scrolling") so the evaluator can scope the gate. priority is the rule's precedence verbatim (highest priority wins).
Validation: this helper trusts the caller to pass a token recognised by the DisableEngine descriptor's validator. The Settings layer routes Mode → token through PhosphorZones::modeToWireString, so an unrecognised token here is a programmer error and the resulting rule would be rejected at load by RuleAction::fromJson. Passing an empty token writes a malformed rule with action params {mode: ""} — also caught at load.
|
inline |
True if match is the exact-shape context for screenId / virtualDesktop / activity — i.e.
the match makeContextMatch would emit for that tuple. A match pinning different dimensions or carrying any window-property leaf is rejected. Equivalent to matchIsExactContext* plus an explicit value check.
|
inline |
BROAD per-activity family classifier — true if match is a context-only rule pinning an activity (with screen), whether or not it ALSO pins a desktop.
Used by the cascade-family union isContextAssignmentRule (in layoutregistry_rulehelpers.cpp) to admit Combined rules into the cascade-family union.
DO NOT use as a per-activity batch reader/writer family classifier — the Activity batch API ((screen, activity) → layout) cannot represent a desktop-pinned Combined rule, so a round-trip through this predicate silently drops the desktop pin. Use matchIsExactContextActivityStrict for the strict per-Activity classifier.
|
inline |
STRICT per-activity classifier — screen+activity ONLY, no desktop pin.
Used by the Activity batch reader/writer (activityAssignments() / setAllActivityAssignments) so a Combined rule is NOT projected through the (screen, activity) key (would otherwise overwrite a pure-Activity entry or get its desktop pin dropped on round-trip). Combined rules live outside the Activity API's projection and only round-trip through the dedicated Combined batch.
|
inline |
True if match is a context-only "screen-only" pin — screen present, no desktop, no activity.
The per-screen-base family classifier.
|
inline |
STRICT Combined classifier — screen + desktop + activity all pinned.
Used by the Combined batch API's family classifier so the round-trip touches ONLY Combined rules and leaves the other axes (Monitor, Desktop, Activity) untouched.
|
inline |
True if match is a context-only "screen + desktop" pin (no activity).
The per-desktop family classifier — a screen+desktop+activity tuple is the Combined axis and does NOT match this family.
|
inline |
True if match pins a context field that is NOT one of the three cascade dimensions — any context field outside kContextDimensionFields (Mode, TiledWindowCount, the screen orientation, width, height and aspect ratio, ActiveLayout, ColorScheme).
Such a match is more specific than the (screen, desktop, activity) shape makeContextMatch emits, so it must not be treated as an exact-context assignment: the batch reader/writers and exact-rule upsert rebuild the context base from the decoded dims alone, which would silently drop the extra leaf (the same hazard matchIsExactContextActivityStrict guards against for Combined rules).
The set is derived from kFieldTable — every FieldSource::Context row that is not one of kContextDimensionFields — so a context field added to the table is guarded here without a second edit. It is built once into a function-local static, so the per-rule batch classifiers do not reconstruct it on every call.
|
inline |
rules with the desktops and activities they name moved by remap.
A CONTEXT rule (the exact (screen, desktop, activity) shape: context-only, no pinned non-dimension field, decoded by contextDimsOf) that this bridge minted or that carries only context-domain actions (detail::isContextSetting) is that context's own setting, whoever wrote it: the layout registry claims such a rule as the context's assignment by its shape. Pinned to a desktop or an activity that is gone it is dropped. Pinned to a desktop that moved it is re-pinned there, and when this bridge minted it its deterministic id and its generated name follow the new tuple; a hand-built one keeps both.
Every other rule (a window rule, a context match of another shape, or the exact shape carrying a window action) keeps its id and name and follows its desktops through detail::remapRuleDesktops, which switches it off when it named a removed desktop; the activities it names are not touched.
The walk builds a fresh list, so a reorder cannot collide two re-minted ids. A rule left in place that ends on a moved rule's id (a stale rule past the old desktop list) is dropped and the moved one kept, unless ContextRemap::applies held it: then the moved one is dropped.
|
inlineconstexpr |
Default precedence band base for context rules (zone assignments and per-mode disables).
With specificity removed, priority is the only precedence value: callers seed new context rules in this band and the Settings list-order renormalizer / runtime upsert derive concrete values from it. Kept numerically in sync with RuleTemplates::kContextBandBase (src/settings/rules/ruletemplates.h), which the settings tree defines separately.
|
inlineconstexpr |
The three cascade dimensions makeContextMatch can emit — the only context fields contextDimsOf decodes back out of a match.