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.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "DesktopEntry.hpp"
|
|
|
|
#include <QAbstractListModel>
|
|
#include <QVector>
|
|
#include <QtQml/qqmlregistration.h>
|
|
|
|
class ApplicationModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
QML_ELEMENT
|
|
QML_UNCREATABLE("Obtained from ApplicationService")
|
|
Q_PROPERTY(int count READ count NOTIFY countChanged)
|
|
|
|
public:
|
|
enum Roles {
|
|
DesktopIdRole = Qt::UserRole + 1,
|
|
NameRole,
|
|
GenericNameRole,
|
|
CommentRole,
|
|
IconNameRole,
|
|
CategoriesRole,
|
|
TerminalRole
|
|
};
|
|
Q_ENUM(Roles)
|
|
|
|
explicit ApplicationModel(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 setEntries(QVector<DesktopEntry> entries);
|
|
const DesktopEntry *entryAt(int row) const;
|
|
const DesktopEntry *entryById(const QString &desktopId) const;
|
|
const DesktopEntry *entryMatchingWindow(const QString &appId, const QString &windowClass) const;
|
|
|
|
signals:
|
|
void countChanged();
|
|
|
|
private:
|
|
QVector<DesktopEntry> m_entries;
|
|
};
|