Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
DecorationSupportedPaths.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 <QLatin1Char>
7#include <QSet>
8#include <QString>
9#include <QStringList>
10
11namespace PhosphorSurfaceShaders {
12
20{
21 return QStringLiteral("shell");
22}
24{
25 return QStringLiteral("shell.panel");
26}
28{
29 return QStringLiteral("shell.appletPopup");
30}
31
38{
39 return QStringLiteral("window.tiled");
40}
42{
43 return QStringLiteral("window.snapped");
44}
46{
47 return QStringLiteral("window.floating");
48}
49
54inline QString decorationOsdPath()
55{
56 return QStringLiteral("osd");
57}
59{
60 return QStringLiteral("popup.layoutPicker");
61}
63{
64 return QStringLiteral("popup.zoneSelector");
65}
67{
68 return QStringLiteral("popup.cheatsheet");
69}
71{
72 return QStringLiteral("popup.snapAssist");
73}
74
83{
84 return QStringLiteral("shell.phosphor");
85}
87{
88 return QStringLiteral("shell.phosphor.bar");
89}
91{
92 return QStringLiteral("shell.phosphor.popout");
93}
95{
96 return QStringLiteral("shell.phosphor.osd");
97}
99{
100 return QStringLiteral("shell.phosphor.notification");
101}
103{
104 return QStringLiteral("shell.phosphor.picker");
105}
107{
108 return QStringLiteral("shell.phosphor.lock");
109}
116
120inline QString decorationPointerPath()
121{
122 return QStringLiteral("pointer");
123}
124
140inline QStringList decorationLeafSurfacePaths()
141{
142 return QStringList{
143 // window.* — per-placement window decoration (border / corners /
144 // titlebar appearance + surface-pack chain) for each placement state.
148 // osd — the notification surface.
150 // popup.* — the four transient overlays invoked by user action.
155 // shell.* — surfaces owned by plasmashell rather than by us or by an
156 // application. Unlike every path above, these are FOREIGN windows the
157 // KWin effect decorates in place. The subtree is baseline-isolated
158 // (decorationPathIsBaselineIsolated below): a shell surface never
159 // inherits the tree baseline, so it stays undecorated until a chain is
160 // engaged at `shell` or one of its leaves — engaging that chain IS the
161 // opt-in (applying a decoration set that carries shell paths engages
162 // the chain the same way, and counts as the same opt-in: the user
163 // chose to apply the set). It also resolves chain-only: the
164 // config-backed border /
165 // opacity-tint "easy mode" layers never apply to it, so a shell
166 // surface is styled by an explicit pack chain here or not at all.
169 // pointer — the mouse cursor, drawn by the compositor's pointer
170 // pass from a chain of pointer packs. Baseline-isolated, so it
171 // ships undecorated until a chain is engaged at this path.
173 }
175}
176
183inline QString decorationParentPath(const QString& path)
184{
185 if (path.isEmpty())
186 return QString();
187 const int dotIdx = path.lastIndexOf(QLatin1Char('.'));
188 return (dotIdx < 0) ? QString() : path.left(dotIdx);
189}
190
202{
203 QStringList out;
204 QSet<QString> seen;
205 const QStringList leaves = decorationLeafSurfacePaths();
206 for (const QString& leaf : leaves) {
207 QString cursor = leaf;
208 while (!cursor.isEmpty()) {
209 if (!seen.contains(cursor)) {
210 seen.insert(cursor);
211 out.append(cursor);
212 }
213 cursor = decorationParentPath(cursor);
214 }
215 }
216 return out;
217}
218
235inline bool decorationPathIsBaselineIsolated(const QString& path)
236{
237 // Prefix-guarded like the shell family, not matched by equality: a
238 // future `pointer.*` leaf would otherwise fail OPEN and inherit the
239 // surface baseline the paragraph above rules out.
240 const QString pointer = decorationPointerPath();
241 if (path == pointer || path.startsWith(pointer + QLatin1Char('.'))) {
242 return true;
243 }
244 const QString root = decorationShellRootPath();
245 return path == root || path.startsWith(root + QLatin1Char('.'));
246}
247
252inline bool decorationSurfaceSupported(const QString& path)
253{
254 static const QSet<QString> kSupported = []() {
255 const QStringList list = decorationSupportedSurfacePaths();
256 return QSet<QString>(list.cbegin(), list.cend());
257 }();
258 return kSupported.contains(path);
259}
260
261} // namespace PhosphorSurfaceShaders
Definition DecorationProfile.h:31
QString decorationPointerPath()
The mouse pointer.
Definition DecorationSupportedPaths.h:120
QString decorationShellRootPath()
The root of the plasmashell surface subtree and its two leaves.
Definition DecorationSupportedPaths.h:19
QString decorationWindowTiledPath()
The three per-placement window decoration paths.
Definition DecorationSupportedPaths.h:37
QStringList decorationSupportedSurfacePaths()
Single source of truth for "which surface paths can carry a decorationprofile".
Definition DecorationSupportedPaths.h:201
QString decorationPopupSnapAssistPath()
Definition DecorationSupportedPaths.h:70
bool decorationPathIsBaselineIsolated(const QString &path)
Roots whose subtree does NOT inherit the tree baseline.
Definition DecorationSupportedPaths.h:235
QString decorationShellPhosphorLockPath()
Definition DecorationSupportedPaths.h:106
QString decorationOsdPath()
The OSD surface and the four transient overlays invoked by user action.
Definition DecorationSupportedPaths.h:54
QStringList decorationShellPhosphorLeafPaths()
Definition DecorationSupportedPaths.h:110
QString decorationShellPanelPath()
Definition DecorationSupportedPaths.h:23
bool decorationSurfaceSupported(const QString &path)
Convenience predicate: does path name a surface that can carry a decoration profile (a leaf or an anc...
Definition DecorationSupportedPaths.h:252
QString decorationShellPhosphorBarPath()
Definition DecorationSupportedPaths.h:86
QString decorationParentPath(const QString &path)
Walk path up one level in the dot-hierarchy ("window.floating" -> "window" -> "").
Definition DecorationSupportedPaths.h:183
QString decorationPopupZoneSelectorPath()
Definition DecorationSupportedPaths.h:62
QString decorationShellPhosphorRootPath()
The Phosphor shell's own surfaces, a family under shell beside the plasmashell leaves.
Definition DecorationSupportedPaths.h:82
QString decorationShellPhosphorPickerPath()
Definition DecorationSupportedPaths.h:102
QString decorationShellAppletPopupPath()
Definition DecorationSupportedPaths.h:27
QString decorationShellPhosphorOsdPath()
Definition DecorationSupportedPaths.h:94
QString decorationShellPhosphorNotificationPath()
Definition DecorationSupportedPaths.h:98
QString decorationWindowFloatingPath()
Definition DecorationSupportedPaths.h:45
QString decorationPopupLayoutPickerPath()
Definition DecorationSupportedPaths.h:58
QString decorationPopupCheatsheetPath()
Definition DecorationSupportedPaths.h:66
QStringList decorationLeafSurfacePaths()
Leaf surface paths a per-surface decoration profile actually resolves against.
Definition DecorationSupportedPaths.h:140
QString decorationWindowSnappedPath()
Definition DecorationSupportedPaths.h:41
QString decorationShellPhosphorPopoutPath()
Definition DecorationSupportedPaths.h:90