Files
Nebula-OS/core/windows/WindowModel.hpp
T
andrew 2f59d3c115 Add Nebula.Windows with Sway IPC backend
Introduces a new `core/windows` module (`Nebula.Windows`) with `WindowService`, window/workspace models, and a Sway IPC backend for live window tracking and control (focus, close, move/resize, snap, maximize/restore, minimize, workspace switch). The desktop shell now links this module, uses compositor focus for top-bar active app text, and adds an Open Windows section in the launcher with focus/close actions.

Also updates application metadata handling to parse `StartupWMClass` and map window `app_id`/class to friendly names and icons, and revises Sway config/docs for the new floating-first Desktop 0.2 behavior with temporary compositor-provided decorations.
2026-08-26 18:20:56 +12:00

55 lines
1.2 KiB
C++

#pragma once
#include "WindowTypes.hpp"
#include <QAbstractListModel>
#include <QVector>
#include <QtQml/qqmlregistration.h>
class WindowModel : public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Obtained from WindowService")
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
enum Roles {
WindowIdRole = Qt::UserRole + 1,
TitleRole,
AppIdRole,
WindowClassRole,
WorkspaceRole,
FocusedRole,
FloatingRole,
FullscreenRole,
XRole,
YRole,
WidthRole,
HeightRole,
DisplayNameRole,
IconNameRole,
MinimizedRole,
MaximizedRole,
OutputRole
};
Q_ENUM(Roles)
explicit WindowModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
int count() const;
void setWindows(QVector<WindowInfo> windows);
const WindowInfo *windowAt(int row) const;
const WindowInfo *windowById(qint64 windowId) const;
signals:
void countChanged();
private:
QVector<WindowInfo> m_windows;
};