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

KWin's virtual desktops, over org.kde.KWin.VirtualDesktopManager on the session bus. More...

#include <PhosphorWorkspaces/Plasma/KWinVirtualDesktopBackend.h>

Inheritance diagram for PhosphorWorkspaces::KWinVirtualDesktopBackend:
[legend]

Public Member Functions

 KWinVirtualDesktopBackend (QObject *parent=nullptr)
 ~KWinVirtualDesktopBackend () override
bool connectToSource () override
 Probe KWin's interface. False on a session without KWin.
bool isReachable () const override
 KWin's service is on the bus (QDBusInterface follows its owner).
void subscribe () override
 Start and stop emitting the change signals.
void unsubscribe () override
std::optional< Snapshot > readSnapshot () override
 Read the whole list now, blocking the caller.
void readSnapshotAsync (SnapshotCallback done) override
 Read the whole list without blocking.
void setCurrentDesktop (const QString &desktopId) override
 Switch to the desktop with this id, without waiting for the switch: it arrives as currentChanged.
void createDesktop (uint position, const QString &name, AnswerCallback done) override
 Create a desktop at a 0-based position.
void removeDesktop (const QString &desktopId, AnswerCallback done) override
 Remove a desktop. done as for createDesktop.
void setDesktopName (const QString &desktopId, const QString &name) override
 Rename a desktop. The new name arrives as desktopDataChanged.
Public Member Functions inherited from PhosphorWorkspaces::IVirtualDesktopBackend
 IVirtualDesktopBackend (QObject *parent=nullptr)
 ~IVirtualDesktopBackend () override=default

Additional Inherited Members

Public Types inherited from PhosphorWorkspaces::IVirtualDesktopBackend
using SnapshotCallback = std::function<void(std::optional<Snapshot> snapshot)>
using AnswerCallback = std::function<void(bool answered)>
 answered is false for an error or a timeout: a stall, not a refusal.
Signals inherited from PhosphorWorkspaces::IVirtualDesktopBackend
void currentChanged (const QString &desktopId)
void countChanged (int count)
 The desktop count, which closes a create, a remove or a resize: every desktop signal of the change went out before it.
void desktopCreated (const QString &desktopId, int position, const QString &name)
void desktopCreatedUnreadable (const QString &desktopId)
 A desktop was created but its data could not be read.
void desktopDataChanged (const QString &desktopId, int position, const QString &name)
 A desktop was renamed or moved; position is its new one.
void desktopDataChangedUnreadable ()
 A desktop's data changed but could not be read.
void desktopRemoved (const QString &desktopId)
void rowsChanged (int rows)
 The grid's row count changed (a reshape moves no desktop).

Detailed Description

KWin's virtual desktops, over org.kde.KWin.VirtualDesktopManager on the session bus.

Every call to KWin is bounded at a second. The list reads go through the connection KWin sends its desktop signals on, so a read's reply comes after every signal KWin sent before handling it.

Constructor & Destructor Documentation

◆ KWinVirtualDesktopBackend()

PhosphorWorkspaces::KWinVirtualDesktopBackend::KWinVirtualDesktopBackend ( QObject * parent = nullptr)
explicit

◆ ~KWinVirtualDesktopBackend()

PhosphorWorkspaces::KWinVirtualDesktopBackend::~KWinVirtualDesktopBackend ( )
override

Member Function Documentation

◆ connectToSource()

bool PhosphorWorkspaces::KWinVirtualDesktopBackend::connectToSource ( )
overridevirtual

Probe KWin's interface. False on a session without KWin.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ createDesktop()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::createDesktop ( uint position,
const QString & name,
AnswerCallback done )
overridevirtual

Create a desktop at a 0-based position.

done runs once the compositor answered, after any desktopCreated the call caused, and never after this backend is destroyed.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ isReachable()

bool PhosphorWorkspaces::KWinVirtualDesktopBackend::isReachable ( ) const
overridevirtual

KWin's service is on the bus (QDBusInterface follows its owner).

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ readSnapshot()

std::optional< Snapshot > PhosphorWorkspaces::KWinVirtualDesktopBackend::readSnapshot ( )
overridevirtual

Read the whole list now, blocking the caller.

nullopt when the read failed. Used only while the manager is not running (before start(), after stop()).

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ readSnapshotAsync()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::readSnapshotAsync ( SnapshotCallback done)
overridevirtual

Read the whole list without blocking.

done runs once, with nullopt when the read failed, and never after this backend is destroyed.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ removeDesktop()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::removeDesktop ( const QString & desktopId,
AnswerCallback done )
overridevirtual

Remove a desktop. done as for createDesktop.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ setCurrentDesktop()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::setCurrentDesktop ( const QString & desktopId)
overridevirtual

Switch to the desktop with this id, without waiting for the switch: it arrives as currentChanged.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ setDesktopName()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::setDesktopName ( const QString & desktopId,
const QString & name )
overridevirtual

Rename a desktop. The new name arrives as desktopDataChanged.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ subscribe()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::subscribe ( )
overridevirtual

Start and stop emitting the change signals.

Each is called only when the other was last, so neither needs to guard against doubling.

Implements PhosphorWorkspaces::IVirtualDesktopBackend.

◆ unsubscribe()

void PhosphorWorkspaces::KWinVirtualDesktopBackend::unsubscribe ( )
overridevirtual

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