Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorRules::ContextRuleBridge::detail Namespace Reference

Functions

const QUuid & namespaceUuid ()
 Fixed v5-UUID namespace for context-rule identities.
QString contextIdentityKey (QLatin1StringView family, const QString &screenId, int virtualDesktop, const QString &activity)
 Stable per-rule key for the v5-UUID derivation.
MatchExpression remapDesktopLeaves (const MatchExpression &match, const std::function< int(int)> &desktop, bool &namedGone)
 match with every VirtualDesktop Equals leaf, at any depth, moved through desktop.
bool remapRuleDesktops (Rule &rule, const std::function< int(int)> &desktop)
 A rule that is not one context's own setting follows its desktops: its VirtualDesktop Equals leaves and its RouteToDesktop target move through desktop, and when one of them named a desktop that is gone the rule is switched off, not deleted, so it stays in the rule editor to be fixed.
bool isContextSetting (const Rule &rule, const QString &screenId, int virtualDesktop, const QString &activity)
 Whether rule, whose match is the exact context shape decoded into the tuple, is that context's own setting: this bridge minted it for the tuple, or every action it carries is a context-domain one.
QString encodeSegment (const QString &segment)
 Length-prefix a segment so concatenated identity keys are unambiguous: a screenId / activity may itself contain a |, so a plain |-joined key could collide for two distinct tuples.

Function Documentation

◆ contextIdentityKey()

QString PhosphorRules::ContextRuleBridge::detail::contextIdentityKey ( QLatin1StringView family,
const QString & screenId,
int virtualDesktop,
const QString & activity )
inline

Stable per-rule key for the v5-UUID derivation.

family distinguishes the rule kinds that share a (screen, desktop, activity) tuple — an assignment rule and a disable rule for the same context must not collide on id. Segments are length-prefixed so no two distinct tuples can collide.

◆ encodeSegment()

QString PhosphorRules::Detail::encodeSegment ( const QString & segment)
inline

Length-prefix a segment so concatenated identity keys are unambiguous: a screenId / activity may itself contain a |, so a plain |-joined key could collide for two distinct tuples.

"<len>:<segment>" makes every tuple's encoding unique. Re-exported from the shared IdentityKey.h so the three bridges share one implementation.

◆ isContextSetting()

bool PhosphorRules::ContextRuleBridge::detail::isContextSetting ( const Rule & rule,
const QString & screenId,
int virtualDesktop,
const QString & activity )
inline

Whether rule, whose match is the exact context shape decoded into the tuple, is that context's own setting: this bridge minted it for the tuple, or every action it carries is a context-domain one.

A window rule with a context-shaped match ("Desktop is 3" with Float) is not (F1092).

◆ namespaceUuid()

const QUuid & PhosphorRules::ContextRuleBridge::detail::namespaceUuid ( )
inline

Fixed v5-UUID namespace for context-rule identities.

Deriving each rule's id deterministically from its source identity makes the migration idempotent: converting the same context input twice yields rule sets that compare equal, so RuleStore::setAllRules keeps its no-op fast path.

◆ remapDesktopLeaves()

MatchExpression PhosphorRules::ContextRuleBridge::detail::remapDesktopLeaves ( const MatchExpression & match,
const std::function< int(int)> & desktop,
bool & namedGone )
inline

match with every VirtualDesktop Equals leaf, at any depth, moved through desktop.

A leaf naming a desktop that is gone keeps its value and sets namedGone. A GreaterThan / LessThan bound is left as written: after a reorder there is no single bound that names the same desktops.

◆ remapRuleDesktops()

bool PhosphorRules::ContextRuleBridge::detail::remapRuleDesktops ( Rule & rule,
const std::function< int(int)> & desktop )
inline

A rule that is not one context's own setting follows its desktops: its VirtualDesktop Equals leaves and its RouteToDesktop target move through desktop, and when one of them named a desktop that is gone the rule is switched off, not deleted, so it stays in the rule editor to be fixed.

True when rule changed.