Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
Phosphor::Screens::PlasmaPanelSource Class Referencefinal

IPanelSource implementation that queries KDE Plasma Shell over D-Bus for panel-reservation offsets. More...

#include <phosphor-screens/include/PhosphorScreens/PlasmaPanelSource.h>

Inheritance diagram for Phosphor::Screens::PlasmaPanelSource:
[legend]

Public Member Functions

 PlasmaPanelSource (QObject *parent=nullptr)
 
 ~PlasmaPanelSource () override
 
void start () override
 Begin watching.
 
void stop () override
 Stop watching.
 
Offsets currentOffsets (QScreen *screen) const override
 Snapshot for a given screen.
 
bool ready () const override
 Has any successful query landed? Drives ScreenManager's panelGeometryReady one-shot signal — consumers that compute initial zone geometry at daemon startup gate on this so they don't lay out windows against the unreserved screen rect.
 
void requestRequery (int delayMs=0) override
 Best-effort: ask the backend to re-query immediately, optionally after a short delay (e.g.
 
- Public Member Functions inherited from Phosphor::Screens::IPanelSource
 IPanelSource (QObject *parent=nullptr)
 
 ~IPanelSource () override=default
 

Additional Inherited Members

- Signals inherited from Phosphor::Screens::IPanelSource
void panelOffsetsChanged (QScreen *screen)
 Offsets for screen changed.
 
void requeryCompleted ()
 A requestRequery cycle completed.
 

Detailed Description

IPanelSource implementation that queries KDE Plasma Shell over D-Bus for panel-reservation offsets.

Pure D-Bus client — links Qt6::DBus only, no KF6, no KDE Frameworks. Built into PhosphorScreens unconditionally; consumers on non-KDE desktops just wire a different IPanelSource (typically NoOpPanelSource).

Lifecycle:

  • On start(), watches org.kde.plasmashell registration. Kicks off an initial async query immediately if the service is already on the bus, otherwise waits for the registration signal.
  • Async D-Bus calls only — the GUI thread is never blocked.
  • Per-screen offsets keyed by QScreen::name() (the connector name). Plasma's panel API exposes a screen INDEX which can disagree with Qt's screen list ordering on multi-monitor setups, so we match by screen geometry instead.

Coalescing: rapid requestRequery calls coalesce into a single in-flight D-Bus call. The watcher slot fires requeryCompleted exactly once per outstanding request after the reply lands.

Constructor & Destructor Documentation

◆ PlasmaPanelSource()

Phosphor::Screens::PlasmaPanelSource::PlasmaPanelSource ( QObject *  parent = nullptr)
explicit

◆ ~PlasmaPanelSource()

Phosphor::Screens::PlasmaPanelSource::~PlasmaPanelSource ( )
override

Member Function Documentation

◆ currentOffsets()

Offsets Phosphor::Screens::PlasmaPanelSource::currentOffsets ( QScreen *  screen) const
overridevirtual

Snapshot for a given screen.

Returns zero offsets if the source has no information for this screen yet.

Implements Phosphor::Screens::IPanelSource.

◆ ready()

bool Phosphor::Screens::PlasmaPanelSource::ready ( ) const
overridevirtual

Has any successful query landed? Drives ScreenManager's panelGeometryReady one-shot signal — consumers that compute initial zone geometry at daemon startup gate on this so they don't lay out windows against the unreserved screen rect.

Latch semantics: implementations MAY keep ready() returning true across stop / start cycles — the contract is "panels have been queried successfully at least once", not "a fresh query has completed since the last start". Consumers that need a liveness indicator should listen for requeryCompleted after their own requestRequery, rather than polling ready().

Implements Phosphor::Screens::IPanelSource.

◆ requestRequery()

void Phosphor::Screens::PlasmaPanelSource::requestRequery ( int  delayMs = 0)
overridevirtual

Best-effort: ask the backend to re-query immediately, optionally after a short delay (e.g.

to let a panel-editor UI close fully before settling). Implementations that don't support push-style refresh can no-op; requeryCompleted is still expected to fire at most once per call so callers can chain UI updates.

Implements Phosphor::Screens::IPanelSource.

◆ start()

void Phosphor::Screens::PlasmaPanelSource::start ( )
overridevirtual

Begin watching.

Implementations may emit panelOffsetsChanged any time after this returns; ScreenManager reads currentOffsets on each emission to refresh its cache.

Implements Phosphor::Screens::IPanelSource.

◆ stop()

void Phosphor::Screens::PlasmaPanelSource::stop ( )
overridevirtual

Stop watching.

Subsequent currentOffsets queries should still return the last-known values; only the change channel is closed.

Implements Phosphor::Screens::IPanelSource.


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