Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
VirtualDesktopManager.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
7#include <phosphorworkspaces_export.h>
8#include <QObject>
9#include <QStringList>
10
11class QDBusInterface;
12class QDBusMessage;
13
14namespace PhosphorWorkspaces {
15
16class PHOSPHORWORKSPACES_EXPORT VirtualDesktopManager : public QObject, public PhosphorEngine::IVirtualDesktopManager
17{
18 Q_OBJECT
19
20public:
21 explicit VirtualDesktopManager(QObject* parent = nullptr);
23
24 bool init();
25 void start();
26 void stop();
27
28 int currentDesktop() const override;
29 void setCurrentDesktop(int desktop);
30 int desktopCount() const;
31 QStringList desktopNames() const;
32
33Q_SIGNALS:
34 void currentDesktopChanged(int desktop);
35 void desktopCountChanged(int count);
36
37private Q_SLOTS:
38 void onCurrentDesktopChanged(int desktop);
39 void onNumberOfDesktopsChanged(int count);
40 void refreshFromKWin();
41 void onKWinCurrentChanged(const QString& desktopId);
42 void onKWinDesktopCreated();
43 void onKWinDesktopRemoved();
44
45private:
46 void initKWinDBus();
47 void applyDesktopListReply(const QDBusMessage& reply, const QString& currentId);
48
49 QDBusInterface* m_kwinVDInterface = nullptr;
50 bool m_running = false;
51 bool m_useKWinDBus = false;
52 int m_currentDesktop = 1;
53 int m_desktopCount = 1;
54 QStringList m_desktopNames;
55 QStringList m_desktopIds;
56 uint m_refreshGeneration = 0;
57};
58
59} // namespace PhosphorWorkspaces
Definition IVirtualDesktopManager.h:11
Definition VirtualDesktopManager.h:17
VirtualDesktopManager(QObject *parent=nullptr)
Definition WindowTrackingService.h:45