Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorIdentity::VirtualScreenId Namespace Reference

Virtual-screen ID format utilities. More...

Functions

bool isVirtual (const QString &screenId)
 Check if a screen ID is a virtual screen ID (contains "/vs:").
 
QString extractPhysicalId (const QString &screenId)
 Extract the physical screen ID from a virtual screen ID.
 
int extractIndex (const QString &screenId)
 Extract the virtual screen index from a virtual screen ID.
 
QString make (const QString &physicalScreenId, int index)
 Construct a virtual screen ID from physical ID and index.
 
bool samePhysical (const QString &idA, const QString &idB)
 Check if two screen IDs share the same physical screen.
 
bool isVirtualScreenCrossing (const QString &oldScreenId, const QString &newScreenId)
 Detect a virtual-screen crossing: the screen IDs differ, but both belong to the same physical monitor.
 

Variables

constexpr QLatin1String Separator {"/vs:"}
 Separator between physical screen ID and virtual index.
 

Detailed Description

Virtual-screen ID format utilities.

Stable cross-process format for the IDs that identify a sub-region of a physical monitor when the user has subdivided it: "<physicalId>/vs:<index>".

Same role as WindowId for window identity — a single source of truth for the wire-format string. Daemon, KWin effect, KCM, and any future compositor plugin must spell it the same way; this header is the place to change that spelling if it ever needs to change.

Header-only and inline throughout: no link cost, safe to include everywhere identity strings are handled.

Function Documentation

◆ extractIndex()

int PhosphorIdentity::VirtualScreenId::extractIndex ( const QString &  screenId)
inline

Extract the virtual screen index from a virtual screen ID.

Returns -1 if not a virtual screen ID.

◆ extractPhysicalId()

QString PhosphorIdentity::VirtualScreenId::extractPhysicalId ( const QString &  screenId)
inline

Extract the physical screen ID from a virtual screen ID.

Returns the original ID if not a virtual screen ID.

◆ isVirtual()

bool PhosphorIdentity::VirtualScreenId::isVirtual ( const QString &  screenId)
inline

Check if a screen ID is a virtual screen ID (contains "/vs:").

◆ isVirtualScreenCrossing()

bool PhosphorIdentity::VirtualScreenId::isVirtualScreenCrossing ( const QString &  oldScreenId,
const QString &  newScreenId 
)
inline

Detect a virtual-screen crossing: the screen IDs differ, but both belong to the same physical monitor.

Returns false when both IDs are plain physical IDs (outputChanged handles those) or when they belong to different physical monitors.

◆ make()

QString PhosphorIdentity::VirtualScreenId::make ( const QString &  physicalScreenId,
int  index 
)
inline

Construct a virtual screen ID from physical ID and index.

Precondition
index must be >= 0; negative indices return an empty string.

◆ samePhysical()

bool PhosphorIdentity::VirtualScreenId::samePhysical ( const QString &  idA,
const QString &  idB 
)
inline

Check if two screen IDs share the same physical screen.

For virtual screens (containing "/vs:"), strips the suffix before comparing.

Variable Documentation

◆ Separator

constexpr QLatin1String PhosphorIdentity::VirtualScreenId::Separator {"/vs:"}
inlineconstexpr

Separator between physical screen ID and virtual index.