Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorContext::IWorkspaceState Class Referenceabstract

Adapter interfaces the concrete ContextResolver depends on. More...

#include <PhosphorContext/IContextInputs.h>

Public Member Functions

virtual ~IWorkspaceState ()=default
virtual int currentVirtualDesktop () const =0
 1-based desktop index.
virtual int currentVirtualDesktopForScreen (const QString &screenId) const
 1-based desktop index for a specific screen (Plasma 6.7 "switch desktops independently for each screen", #648).
virtual QString currentActivity () const =0
 Current activity uuid.

Detailed Description

Adapter interfaces the concrete ContextResolver depends on.

The resolver itself is a thin façade — it owns no state, holds non-owning pointers to one of each interface here, and routes every public call into the right combination of them. Splitting the dependencies into three narrow interfaces (instead of a single fat IInputs) lets test fakes stub one axis at a time and lets daemon-side wiring use whatever object already implements each axis (typically the existing VirtualDesktopManager + ActivityManager for workspace state, a ScreenModeRouter shim for mode, and the existing ISettings for the gate source).

All three interfaces are read-only. The resolver never mutates its inputs; consumers that need to write through to the underlying settings (e.g. flipping a monitor-disable list) keep calling the writer surface directly.

Workspace-clock adapter.

Supplies the "where is the user RIGHT NOW" axis values that every context-handle freezes at snapshot time. The daemon-side implementation forwards to PhosphorWorkspaces' VirtualDesktopManager and ActivityManager respectively; the test fake holds a pair of mutable fields and lets the test scenario drive them by hand.

Returning 0 for desktop and the empty string for activity is the documented "no workspace concept" fallback — the daemon's own Daemon::currentDesktop() / currentActivity() use the same sentinels when their respective manager pointers are null.

Constructor & Destructor Documentation

◆ ~IWorkspaceState()

virtual PhosphorContext::IWorkspaceState::~IWorkspaceState ( )
virtualdefault

Member Function Documentation

◆ currentActivity()

virtual QString PhosphorContext::IWorkspaceState::currentActivity ( ) const
pure virtual

Current activity uuid.

Empty when no ActivityManager is wired or no activity is currently active.

◆ currentVirtualDesktop()

virtual int PhosphorContext::IWorkspaceState::currentVirtualDesktop ( ) const
pure virtual

1-based desktop index.

Returns 0 when "pinned to all desktops" or when no VirtualDesktopManager is wired.

◆ currentVirtualDesktopForScreen()

virtual int PhosphorContext::IWorkspaceState::currentVirtualDesktopForScreen ( const QString & screenId) const
inlinevirtual

1-based desktop index for a specific screen (Plasma 6.7 "switch desktops independently for each screen", #648).

The default ignores the screen and returns the global currentVirtualDesktop(), so single-desktop setups and non-per-output implementers are unaffected.


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