Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorZones::AssignmentEntry Struct Reference

Explicit per-context assignment entry storing every mode's payload. More...

#include <phosphor-zones/include/PhosphorZones/AssignmentEntry.h>

Public Types

enum  Mode { Snapping = 0 , Autotile = 1 , Scrolling = 2 }
 Per-context engine selection. More...
 

Public Member Functions

QString activeLayoutId () const
 
bool isValid () const
 True when the entry carries a layout/algorithm PAYLOAD — including the reserved opt-out word, which is a stored choice, not an absence (an entry whose only content is "none" answers true here).
 
bool operator== (const AssignmentEntry &other) const
 

Static Public Member Functions

static AssignmentEntry fromLayoutId (const QString &layoutId, const AssignmentEntry &existing)
 Update an existing AssignmentEntry from a layoutId, preserving the "other" field.
 
static AssignmentEntry fromLayoutId (const QString &layoutId)
 Create a fresh AssignmentEntry from a layoutId string.
 

Public Attributes

Mode mode = Snapping
 
QString snappingLayout
 
QString tilingAlgorithm
 
QString scrollingTemplateLayout
 Id of the native scrolling template (ScrollingTemplate) a Scrolling context uses for its seed blueprint, default column width and preset vocabularies.
 

Detailed Description

Explicit per-context assignment entry storing every mode's payload.

Each screen/desktop/activity context stores an explicit Mode plus all three per-mode payloads: SnappingLayout (UUID), PhosphorTiles::TilingAlgorithm, and ScrollingTemplateLayout (UUID). Toggling between modes only flips the mode field — the other fields are preserved, eliminating the need for shadow assignments.

Member Enumeration Documentation

◆ Mode

Per-context engine selection.

The v4 rule store persists the WIRE STRINGS produced by modeToWireString ("snapping", "autotile", "scrolling") — ContextRuleBridge::makeDisableRule writes them and disableRuleMode reads them back. A consumer's legacy v3→v4 config migration does still read the int side from the assignments group (Assignment:<screen>…, key Mode — NOT the Display.* per-mode disable-list group), so NEVER renumber existing values — a renumber would silently swap engines for v3 disable lists that haven't been migrated yet. Append new modes at the end.

Enumerator
Snapping 
Autotile 
Scrolling 

The niri-style scrolling engine (PhosphorScrollEngine): windows form columns on an endless strip per context (horizontal or vertical, resolved per screen).

ScreenModeRouter::engineFor hands Scrolling screens to the live ScrollEngine; the (Mode, Family) settings table here still drives all downstream config routing. Scrolling consumes no manual layout at all: its sizing comes from a native ScrollingTemplate (scrollingTemplateLayout below), its activeLayoutId() stays the bare "scrolling:" sentinel, and the mode lookup is the discriminator.

Member Function Documentation

◆ activeLayoutId()

QString PhosphorZones::AssignmentEntry::activeLayoutId ( ) const
inline

◆ fromLayoutId() [1/2]

static AssignmentEntry PhosphorZones::AssignmentEntry::fromLayoutId ( const QString &  layoutId)
inlinestatic

Create a fresh AssignmentEntry from a layoutId string.

Exactly the two-arg overload applied to a default-constructed entry — one classification cascade, so a new mode cannot be added to one overload and forgotten in the other.

◆ fromLayoutId() [2/2]

static AssignmentEntry PhosphorZones::AssignmentEntry::fromLayoutId ( const QString &  layoutId,
const AssignmentEntry existing 
)
inlinestatic

Update an existing AssignmentEntry from a layoutId, preserving the "other" field.

Mode IS set from the layoutId type — batch operations from the KCM send a single layout ID per context, and that ID determines the active mode. The non-matching field is preserved for easy mode toggling.

◆ isValid()

bool PhosphorZones::AssignmentEntry::isValid ( ) const
inline

True when the entry carries a layout/algorithm PAYLOAD — including the reserved opt-out word, which is a stored choice, not an absence (an entry whose only content is "none" answers true here).

This is NOT the cascade's visibility predicate — that is activeLayoutId() non-empty, which a payload-less Scrolling entry satisfies through the "scrolling:" sentinel while isValid() stays false. scrollingTemplateLayout is deliberately EXCLUDED: a template never feeds activeLayoutId(), so counting it would make an entry "valid" that still resolves to nothing on a Snapping/Autotile context. Kept for tests/tooling; no production caller branches on it.

◆ operator==()

bool PhosphorZones::AssignmentEntry::operator== ( const AssignmentEntry other) const
inline

Member Data Documentation

◆ mode

Mode PhosphorZones::AssignmentEntry::mode = Snapping

◆ scrollingTemplateLayout

QString PhosphorZones::AssignmentEntry::scrollingTemplateLayout

Id of the native scrolling template (ScrollingTemplate) a Scrolling context uses for its seed blueprint, default column width and preset vocabularies.

Its own UUID namespace, disjoint from manual layout ids. Deliberately its own field, never a reuse of snappingLayout: the lossless mode-toggle contract preserves the snapping choice across mode flips, and the "scrolling:" sentinel in activeLayoutId() stays payload-free (rules match on the bare sentinel). Three states, not two. A UUID names a template. EMPTY means "not chosen here", which INHERITS the configured default template. NoScrollingTemplate means "explicitly none", which takes no template at all and leaves the engine on its built-in vocabularies even while a default exists.

The third state is why the token exists: with only empty and a UUID, a screen could never opt out of a default someone else had set. It is a reserved word rather than a flag so it rides every existing string path (assignment JSON, the D-Bus slot setter, the rule action) with no schema change, and it is ADDITIVE: no config this project writes can contain it, so nothing needs migrating. (rules.json is hand-editable and the SetScrollingTemplate descriptor accepts any non-empty string, so a hand-written "none" was loadable before and meant the opposite — not a case for migration code, just not a claim worth overstating.)

◆ snappingLayout

QString PhosphorZones::AssignmentEntry::snappingLayout

◆ tilingAlgorithm

QString PhosphorZones::AssignmentEntry::tilingAlgorithm

The documentation for this struct was generated from the following file: