Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
IWindowRegistry.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
6#include "phosphorengine_export.h"
7#include <QList>
8#include <QSet>
9#include <QString>
10#include <QStringList>
11
12#include <optional>
13
14namespace PhosphorEngine {
15
23{
25 QList<int> virtualDesktops;
26 std::optional<bool> sticky;
27 QString activity;
28 QStringList activities{};
29
33 std::optional<QSet<int>> desktopSet() const
34 {
35 if (sticky.value_or(false)) {
36 return std::nullopt;
37 }
38 if (!virtualDesktops.isEmpty()) {
39 return QSet<int>(virtualDesktops.cbegin(), virtualDesktops.cend());
40 }
41 if (virtualDesktop >= 1) {
42 return QSet<int>{virtualDesktop};
43 }
44 return std::nullopt;
45 }
46};
47
48class PHOSPHORENGINE_EXPORT IWindowRegistry
49{
50public:
51 virtual ~IWindowRegistry() = default;
52
73 virtual QString canonicalizeWindowId(const QString& rawWindowId) = 0;
74 virtual QString canonicalizeForLookup(const QString& rawWindowId) const = 0;
81 virtual QString appIdFor(const QString& instanceId) const = 0;
82
102 virtual std::optional<bool> minimizedState(const QString& windowId) const
103 {
104 Q_UNUSED(windowId)
105 return std::nullopt;
106 }
107
115 virtual std::optional<WindowDesktopContext> desktopContext(const QString& windowId) const
116 {
117 Q_UNUSED(windowId)
118 return std::nullopt;
119 }
120
121 // New virtuals go below this line: this interface is installed and
122 // exported, and its vtable order is part of the ABI a released build
123 // shipped.
124
132 virtual std::optional<bool> fillsOutputState(const QString& windowId) const
133 {
134 Q_UNUSED(windowId)
135 return std::nullopt;
136 }
137};
138
139} // namespace PhosphorEngine
Definition IWindowRegistry.h:49
virtual QString appIdFor(const QString &instanceId) const =0
The app identity recorded for instanceId, or empty when the instance is unknown.
virtual std::optional< bool > fillsOutputState(const QString &windowId) const
Whether windowId is maximized on either axis or fullscreen as last reported: engaged true when any of...
Definition IWindowRegistry.h:132
virtual std::optional< bool > minimizedState(const QString &windowId) const
Tri-state compositor minimize state for windowId.
Definition IWindowRegistry.h:102
virtual std::optional< WindowDesktopContext > desktopContext(const QString &windowId) const
The desktop set and activity last reported for windowId (bare instance id or composite appId|instance...
Definition IWindowRegistry.h:115
virtual QString canonicalizeForLookup(const QString &rawWindowId) const =0
virtual QString canonicalizeWindowId(const QString &rawWindowId)=0
Freeze (on first contact) and return the canonical id for rawWindowId's instance.
virtual ~IWindowRegistry()=default
Definition DesktopRemap.h:12
The contexts the compositor last reported a window on, as far as the registry knows them,...
Definition IWindowRegistry.h:23
std::optional< bool > sticky
on all desktops; disengaged when never reported
Definition IWindowRegistry.h:26
QString activity
empty = all activities / unknown
Definition IWindowRegistry.h:27
QList< int > virtualDesktops
full list when the window spans several desktops
Definition IWindowRegistry.h:25
QStringList activities
full list when on several activities; appended last (F426)
Definition IWindowRegistry.h:28
int virtualDesktop
1-based x11 desktop; 0 = all desktops / unknown
Definition IWindowRegistry.h:24
std::optional< QSet< int > > desktopSet() const
The desktops the window is on, or nullopt when it is on all of them or they are unknown: the full lis...
Definition IWindowRegistry.h:33