Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
DesktopRemap.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
8#include <QList>
9#include <QMetaType>
10#include <QStringList>
11
12namespace PhosphorEngine {
13
28class PHOSPHORENGINE_EXPORT DesktopRemap
29{
30public:
31 DesktopRemap() = default;
32
38 static DesktopRemap fromIds(const QStringList& oldIds, const QStringList& newIds);
41 static DesktopRemap removal(int position, int oldCount);
42
45 bool isIdentity() const;
46 int oldCount() const;
47 int newCount() const;
48
51 int map(int oldPosition) const;
59 int successor(int oldPosition) const;
62 int singleRemoval() const;
63
64 bool operator==(const DesktopRemap& other) const = default;
65
66private:
68 QList<int> m_newPositions;
69 int m_newCount = 0;
70};
71
72} // namespace PhosphorEngine
73
74Q_DECLARE_METATYPE(PhosphorEngine::DesktopRemap)
How KWin's desktop positions moved in one change of its desktop list: for each 1-based position in th...
Definition DesktopRemap.h:29
bool operator==(const DesktopRemap &other) const =default
static DesktopRemap removal(int position, int oldCount)
The map for exactly one desktop removed at position out of oldCount.
int singleRemoval() const
The old position when this change is exactly one desktop removed with every other keeping its order,...
int successor(int oldPosition) const
Like map(), except that a removed desktop answers the desktop KWin moves the outputs showing it and t...
static DesktopRemap fromIds(const QStringList &oldIds, const QStringList &newIds)
The map from oldIds to newIds, both in position order.
bool isIdentity() const
True when no old position moves or goes.
int map(int oldPosition) const
The new position of the desktop at oldPosition, or 0 when it was removed.
Definition DesktopRemap.h:12