6#include "phosphorworkspaces_export.h"
69 QList<WorkspaceEntry>
slice(
const QString& screenId)
const;
72 QString
ownerOf(
const QString& desktopId)
const;
106 bool reorderSlice(
const QString& screenId,
const QStringList& orderedIds);
109 bool transfer(
const QString& desktopId,
const QString& toScreenId,
int sliceIndex);
110 void setName(
const QString& desktopId,
const QString& name);
111 void setNamedId(
const QString& desktopId,
const QString& namedId);
117 bool renameScreen(
const QString& fromScreenId,
const QString& toScreenId);
120 QList<WorkspaceEntry>
takeSlice(
const QString& screenId);
152 QString
toJson(quint64 generation,
const QHash<QString, int>& currentByScreen,
153 const std::function<
int(
const QString&)>& indexOf,
bool includeState)
const;
164 return m_screenOrder == other.m_screenOrder && m_slices == other.m_slices;
168 QStringList m_screenOrder;
169 QHash<QString, QList<WorkspaceEntry>> m_slices;
170 QHash<QString, QString> m_ownerOf;
The per-monitor workspace ownership model: screenId → ordered slice of KWin desktop ids,...
Definition WorkspaceMap.h:49
void setScreenOrder(const QStringList &order)
Replace the screen order (left-to-right geometry, ties by id — computed by the caller,...
bool remove(const QString &desktopId)
Remove a desktop from whatever slice owns it.
QString ownerOf(const QString &desktopId) const
Owner screen of a desktop id, or empty when unowned.
QString toJson(quint64 generation, const QHash< QString, int > ¤tByScreen, const std::function< int(const QString &)> &indexOf, bool includeState) const
Map JSON per plan §3.2/§3.3.
QStringList screenOrder() const
QStringList allDesktopIds() const
All owned desktop ids, slice-concatenated in screen order.
bool consistentWith(const QStringList &kwinIds) const
True when every invariant holds against kwinIds (each KWin id owned exactly once, no entry for a vani...
QList< WorkspaceEntry > slice(const QString &screenId) const
int sliceIndexOf(const QString &desktopId) const
Slice position (0-based) of a desktop within its owner, or -1.
void insert(const QString &screenId, int sliceIndex, const WorkspaceEntry &entry)
Insert an entry into a screen's slice at sliceIndex (clamped).
WorkspaceEntry entryFor(const QString &desktopId) const
The entry for a desktop id (owner looked up via the index); nullptr-like default entry when unowned.
bool transfer(const QString &desktopId, const QString &toScreenId, int sliceIndex)
Re-own a desktop to another screen at sliceIndex (clamped); keeps the entry's metadata.
void setHomeScreen(const QString &desktopId, const QString &homeScreenId)
bool knowsScreen(const QString &screenId) const
Whether this screen is part of the world at all: it holds a slice, or it appears in the screen order.
int sliceSize(const QString &screenId) const
void setName(const QString &desktopId, const QString &name)
bool reorderWithinSlice(const QString &desktopId, int newSliceIndex)
Move a desktop within its owner's slice to newSliceIndex (clamped).
bool fromJson(const QString &json)
Parse a state-file or public-form payload into this map.
uint globalPositionForInsert(const QString &screenId, int sliceIndex) const
Global 0-based insert position computed from the MAP alone: the sum of slice sizes of screens precedi...
bool renameScreen(const QString &fromScreenId, const QString &toScreenId)
Re-key a screen in place: its slice, its slot in the screen order and its owner rows move to toScreen...
static constexpr int MaxDesktopIdLength
The longest desktop id fromJson accepts.
Definition WorkspaceMap.h:160
bool operator==(const WorkspaceMap &other) const
Definition WorkspaceMap.h:162
bool reorderSlice(const QString &screenId, const QStringList &orderedIds)
Put a screen's slice in exactly the order orderedIds lists.
QList< WorkspaceEntry > takeSlice(const QString &screenId)
Drop a screen's slice entirely, returning its entries in order (used by hotplug migration,...
void setNamedId(const QString &desktopId, const QString &namedId)
QStringList repairAgainst(const QStringList &kwinIds)
Repair against the authoritative KWin id list: drop entries whose id vanished, report ids KWin has th...
bool hasScreen(const QString &screenId) const
Whether this screen HOLDS A SLICE.
Definition WindowTrackingService.h:46
One owned desktop in a screen's workspace slice.
Definition WorkspaceMap.h:19
QString desktopId
KWin's desktop id, an opaque string.
Definition WorkspaceMap.h:23
QString name
empty = dynamic; non-empty = named (destroy-exempt)
Definition WorkspaceMap.h:24
bool operator==(const WorkspaceEntry &other) const
Definition WorkspaceMap.h:33
QString homeScreenId
set only while displaced by hotplug
Definition WorkspaceMap.h:31
QString namedId
The persistent id of the named-workspace declaration this desktop realizes (NamedWorkspace::id).
Definition WorkspaceMap.h:30