e4507861f7
* Allow to do quick tiling to custom tile geometries, windows will be snapped to tiles when dragged with the shift modifier pressed. * Tile geometries are screen specific. * The global shortcut Meta+T will trigger a fullscreen configuration ui as a QML effect for the tiles which allows to add, remove and resize tiles * UI and behavior is a bit similar to the Windows Fancy Zones addon: https://docs.microsoft.com/en-us/windows/powertoys/fancyzones * Its main scope is to help the workflow with very big monitors, especially ultra wide ones, where most application don't make sense maximized to the full screen (eventually also support games to be full screened to a given tile instead of the whole screen) * it should get also some bindings for scripting, as its ain goal is not to replicate other popular tiling window managers, but should give the popular kwin tiling scripts to have a more robust infrastructure * it will eventually get support for a set of predefined layouts, but this is for a second phase BUG: 438788
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "customtile.h"
|
|
#include "quicktile.h"
|
|
#include "scripting/tilemodel.h"
|
|
#include "tile.h"
|
|
#include "utils/common.h"
|
|
#include <kwin_export.h>
|
|
|
|
#include <QAbstractItemModel>
|
|
#include <QObject>
|
|
#include <QRectF>
|
|
|
|
#include <QJsonValue>
|
|
|
|
class QTimer;
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class Output;
|
|
class Tile;
|
|
class TileModel;
|
|
|
|
/**
|
|
* Custom tiling zones management per output.
|
|
*/
|
|
class KWIN_EXPORT TileManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(KWin::Tile *rootTile READ rootTile CONSTANT)
|
|
Q_PROPERTY(TileModel *model READ model CONSTANT)
|
|
|
|
public:
|
|
explicit TileManager(Output *parent = nullptr);
|
|
~TileManager() override;
|
|
|
|
Output *output() const;
|
|
|
|
KWin::Tile *bestTileForPosition(const QPointF &pos);
|
|
Q_INVOKABLE KWin::Tile *bestTileForPosition(qreal x, qreal y); // For scripting
|
|
CustomTile *rootTile() const;
|
|
KWin::Tile *quickTile(QuickTileMode mode) const;
|
|
|
|
TileModel *model() const;
|
|
|
|
Q_SIGNALS:
|
|
void tileRemoved(KWin::Tile *tile);
|
|
|
|
private:
|
|
void readSettings();
|
|
void saveSettings();
|
|
QJsonObject tileToJSon(CustomTile *parentTile);
|
|
CustomTile *parseTilingJSon(const QJsonValue &val, const QRectF &availableArea, CustomTile *parentTile);
|
|
|
|
Q_DISABLE_COPY(TileManager)
|
|
|
|
Output *m_output = nullptr;
|
|
std::unique_ptr<QTimer> m_saveTimer;
|
|
std::unique_ptr<CustomTile> m_rootTile = nullptr;
|
|
std::unique_ptr<QuickRootTile> m_quickRootTile = nullptr;
|
|
std::unique_ptr<TileModel> m_tileModel = nullptr;
|
|
friend class CustomTile;
|
|
};
|
|
|
|
KWIN_EXPORT QDebug operator<<(QDebug debug, const TileManager *tileManager);
|
|
|
|
} // namespace KWin
|