Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorShell::PlacementMap Class Reference

QML singleton: the placement engine's geometry per screen. More...

#include <PhosphorShell/PlacementMap.h>

Inheritance diagram for PhosphorShell::PlacementMap:
[legend]

Signals

void availableChanged ()

Public Member Functions

 PlacementMap (QObject *parent=nullptr)
 Whether the daemon is on the session bus right now.
 ~PlacementMap () override
PhosphorShell::PlacementMapScreen * forScreen (const QString &screenName)
 The map for a QScreen name (PanelWindow.screen.name).
PhosphorShell::PlacementMapScreen * forScreenDesktop (const QString &screenName, int desktopIndex)
 The map for a QScreen name pinned to the 0-based desktopIndex (a row of Workspaces.model).
bool isAvailable () const
Workspaces * workspaces () const
QHash< QString, QStringList > occupancyForScreen (const QString &screenId) const
 windowId → zone ids for non-floating windows on screenId.
QList< PlacementMapParser::Occupant > occupantsForScreen (const QString &screenId) const
 The non-floating windows on screenId, oldest state change first, so the last occupant of a zone is its topmost window.
QString focusedWindowId () const
 The window the daemon last asked the compositor to focus or activate, or empty.
const QHash< QString, PlacementMapParser::WindowMeta > & windowMetadata () const
 WindowTracking.getWindowMetadata answers so far, by window id.
const QSet< QString > & urgentWindows () const
 Windows demanding attention (getUrgentWindows seeded, then windowUrgencyChanged).
QString currentActivity () const
 The current activity id (LayoutRegistry.getCurrentActivity).

Static Public Member Functions

static PlacementMap * create (QQmlEngine *engine, QJSEngine *scriptEngine)
 QML-singleton factory hook.

Detailed Description

QML singleton: the placement engine's geometry per screen.

import Phosphor.Shell
readonly property var map: PlacementMap.forScreen(screen.name)

One PlacementMapScreen per QScreen name, created on first request, parented here and handed to QML under C++ ownership so the engine never collects it. The singleton holds the process's daemon subscriptions (one per QML engine) and the shared occupancy table; the screens hold their own geometry.

Registered imperatively in ShellEngine::load(), like Workspaces.

Constructor & Destructor Documentation

◆ PlacementMap()

PhosphorShell::PlacementMap::PlacementMap ( QObject * parent = nullptr)
explicit

Whether the daemon is on the session bus right now.

◆ ~PlacementMap()

PhosphorShell::PlacementMap::~PlacementMap ( )
override

Member Function Documentation

◆ availableChanged

void PhosphorShell::PlacementMap::availableChanged ( )
signal

◆ create()

PlacementMap * PhosphorShell::PlacementMap::create ( QQmlEngine * engine,
QJSEngine * scriptEngine )
staticnodiscard

QML-singleton factory hook.

◆ currentActivity()

QString PhosphorShell::PlacementMap::currentActivity ( ) const
nodiscard

The current activity id (LayoutRegistry.getCurrentActivity).

◆ focusedWindowId()

QString PhosphorShell::PlacementMap::focusedWindowId ( ) const
nodiscard

The window the daemon last asked the compositor to focus or activate, or empty.

The focus proxy a screen falls back on until Tiling.managedFocusedWindow has answered for it; see the .cpp.

◆ forScreen()

PhosphorShell::PlacementMapScreen * PhosphorShell::PlacementMap::forScreen ( const QString & screenName)

The map for a QScreen name (PanelWindow.screen.name).

Same object every call; owned by this singleton.

◆ forScreenDesktop()

PhosphorShell::PlacementMapScreen * PhosphorShell::PlacementMap::forScreenDesktop ( const QString & screenName,
int desktopIndex )

The map for a QScreen name pinned to the 0-based desktopIndex (a row of Workspaces.model).

The CURRENT desktop's map is the live one, so this answers forScreen(screenName) for it (and for a negative index); every other desktop gets its own screen object, cached per (screen, desktop) and owned here like the live ones.

That choice is made PER CALL, not maintained. A screen handed back for a non-current desktop stays pinned for its whole life, so switching to that desktop does not turn it into the live map — it keeps tracking through its own refetch rather than the engine's focus and tile edges. A consumer that wants the live map to follow the active desktop must call again when Workspaces.activeIndex changes; binding through that property is enough to re-run this.

◆ isAvailable()

bool PhosphorShell::PlacementMap::isAvailable ( ) const
nodiscard

◆ occupancyForScreen()

QHash< QString, QStringList > PhosphorShell::PlacementMap::occupancyForScreen ( const QString & screenId) const
nodiscard

windowId → zone ids for non-floating windows on screenId.

◆ occupantsForScreen()

QList< PlacementMapParser::Occupant > PhosphorShell::PlacementMap::occupantsForScreen ( const QString & screenId) const
nodiscard

The non-floating windows on screenId, oldest state change first, so the last occupant of a zone is its topmost window.

◆ urgentWindows()

const QSet< QString > & PhosphorShell::PlacementMap::urgentWindows ( ) const
nodiscard

Windows demanding attention (getUrgentWindows seeded, then windowUrgencyChanged).

◆ windowMetadata()

const QHash< QString, PlacementMapParser::WindowMeta > & PhosphorShell::PlacementMap::windowMetadata ( ) const
nodiscard

WindowTracking.getWindowMetadata answers so far, by window id.

◆ workspaces()

Workspaces * PhosphorShell::PlacementMap::workspaces ( ) const
nodiscard

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