Zone data model, layout persistence, zone-detection, and the
ILayoutSourceadapter that publishes manual zone layouts to the daemon.
A zone is a named rectangular region of screen space with metadata: appearance, label, and quick-select slot. A layout is a collection of zones plus per-context (screen / desktop / activity) assignment rules. This library owns:
Zone, Layout, and relative/absolute coordinate conversion utilities.ZoneDetector implements the IZoneDetector interface.LayoutRegistry is the concrete catalogue of manual zone layouts plus the per-context assignment store (which layout is active on which screen / desktop / activity). It implements both IZoneLayoutRegistry (the read-and-mutate-the-catalogue contract) and ILayoutSourceRegistry (the provider contract that ZonesLayoutSource subscribes to).ZonesLayoutSource adapts a layout into the generic ILayoutSource contract so the rest of the stack consumes manual layouts the same way it consumes autotile output. ZonesLayoutSourceFactory registers this source with LayoutSourceProviderRegistry.ZoneHighlighter drives the overlay's per-zone emphasis state machine (hover, active drag target, just-snapped flash).AssignmentEntry and LayoutAssignmentKey carry the (screenId, desktop, activity) keys that LayoutRegistry stores assignments under and that the config backend roundtrips.LayoutRegistry is the concrete counterpart to IZoneLayoutRegistry. The interface exists so consumers that only enumerate or look up layouts (read-only previews, settings UI thumbnails) depend on the smaller contract, which is also trivial to mock.
| Type | Purpose |
|---|---|
PhosphorZones::Zone | Value type: rect, id, label, colors, appearance |
PhosphorZones::Layout | Collection of zones plus app-rule auto-snap mappings |
PhosphorZones::IZoneDetector | Abstract cursor-to-zone resolver |
PhosphorZones::ZoneDetector | Concrete impl with adjacency-graph navigation |
PhosphorZones::IZoneLayoutRegistry | Catalogue contract: enumerate, mutate, set active layout |
PhosphorZones::LayoutRegistry | Concrete IZoneLayoutRegistry + per-context assignment store |
PhosphorZones::ZonesLayoutSource | ILayoutSource adapter for manual layouts |
PhosphorZones::ZonesLayoutSourceFactory | Provider-side factory; registers via LayoutSourceProviderRegistry |
PhosphorZones::AssignmentEntry | Per-context layout assignment value type |
PhosphorZones::LayoutAssignmentKey | (screenId, desktop, activity) key for assignment lookups |
PhosphorZones::ZoneHighlighter | Overlay highlight state machine |
#include <PhosphorZones/LayoutRegistry.h>
#include <PhosphorZones/ZoneDetector.h>
using namespace PhosphorZones;
LayoutRegistry *registry = /* injected */;
Layout *current = registry->layoutForScreen(screenId, desktop, activity);
// Detect which zone the cursor is over
ZoneDetector det;
det.setLayout(current);
Zone *z = det.zoneAtPoint(cursorPos);
if (z) {
overlay.highlight(*z);
}0.0 - 1.0 range, so the same layout works on any screen size. Conversion to pixels happens at read-time.LayoutRegistry is the single concrete class; IZoneLayoutRegistry exists only where mocking is useful. This mirrors phosphor-tiles's AlgorithmRegistry shape.LayoutRegistry per process and inject it into every consumer. Tests build their own per-fixture instance.QtCore, QtGuiILayoutSource and registry contractsIBackend for assignment persistenceLayoutRegistry + ZoneDetector to implement manual snapping.Layout shape via AutotileLayoutSource.