Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
Swapper.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 "phosphorscreenscore_export.h"
7
8#include <QString>
9
10namespace Phosphor::Screens {
11
12class IConfigStore;
13
23namespace Direction {
24inline constexpr QLatin1StringView Left{"left"};
25inline constexpr QLatin1StringView Right{"right"};
26inline constexpr QLatin1StringView Up{"up"};
27inline constexpr QLatin1StringView Down{"down"};
28} // namespace Direction
29
45class PHOSPHORSCREENSCORE_EXPORT VirtualScreenSwapper
46{
47public:
52 enum class Result {
53 Ok,
54 NotVirtual,
61 NoSubdivision,
62 UnknownVirtualScreen,
63 NoSiblingInDirection,
64 InvalidDirection,
68 SwapFailed,
69 SettingsRejected,
70 };
71
73
78 Result swapInDirection(const QString& currentVirtualScreenId, const QString& direction);
79
86 Result rotate(const QString& physicalScreenId, bool clockwise);
87
90 static QString reasonString(Result result);
91
92private:
93 IConfigStore* m_store;
94};
95
96} // namespace Phosphor::Screens
Pluggable persistence for virtual-screen configurations.
Definition IConfigStore.h:37
Scoped helper that performs virtual-screen swap and rotate operations against an injected IConfigStor...
Definition Swapper.h:46
Result swapInDirection(const QString &currentVirtualScreenId, const QString &direction)
Swap the region of currentVirtualScreenId with the adjacent sibling VS in the given direction within ...
static QString reasonString(Result result)
Translate a Result to a stable string token suitable for OSD reasons and D-Bus logs.
VirtualScreenSwapper(IConfigStore *store)
Result rotate(const QString &physicalScreenId, bool clockwise)
Rotate all VS regions on physicalScreenId.
Result
Structured outcome for swap/rotate operations.
Definition Swapper.h:52
constexpr QLatin1StringView Down
Definition Swapper.h:27
constexpr QLatin1StringView Up
Definition Swapper.h:26
constexpr QLatin1StringView Left
Definition Swapper.h:24
constexpr QLatin1StringView Right
Definition Swapper.h:25
Definition IWindowTrackingService.h:26