scripting: Introduce ClientModelByScreenAndActivity

Summary: Provide for KWin scripts the possibility to work with a activities aware ClientModel. In the same way that the ClientModelByScreenAndDesktop works with virtual desktops.

Reviewers: #kwin, mart, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29284
master
Tiago Corrêa 2020-05-11 14:26:39 +03:00 committed by Vlad Zahorodnii
parent d503307858
commit 45c6e4b811
3 changed files with 10 additions and 0 deletions

View File

@ -709,6 +709,7 @@ void KWin::Scripting::init()
qmlRegisterType<KWin::ScriptingClientModel::SimpleClientModel>("org.kde.kwin", 2, 0, "ClientModel");
qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreen>("org.kde.kwin", 2, 0, "ClientModelByScreen");
qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreenAndDesktop>("org.kde.kwin", 2, 0, "ClientModelByScreenAndDesktop");
qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreenAndActivity>("org.kde.kwin", 2, 1, "ClientModelByScreenAndActivity");
qmlRegisterType<KWin::ScriptingClientModel::ClientFilterModel>("org.kde.kwin", 2, 0, "ClientFilterModel");
qmlRegisterType<KWin::AbstractClient>();
qmlRegisterType<KWin::X11Client>();

View File

@ -847,6 +847,7 @@ name::~name() {}
CLIENT_MODEL_WRAPPER(SimpleClientModel, QList<LevelRestriction>())
CLIENT_MODEL_WRAPPER(ClientModelByScreen, QList<LevelRestriction>() << ScreenRestriction)
CLIENT_MODEL_WRAPPER(ClientModelByScreenAndDesktop, QList<LevelRestriction>() << ScreenRestriction << VirtualDesktopRestriction)
CLIENT_MODEL_WRAPPER(ClientModelByScreenAndActivity, QList<LevelRestriction>() << ScreenRestriction << ActivityRestriction)
#undef CLIENT_MODEL_WRAPPER
ClientFilterModel::ClientFilterModel(QObject *parent)

View File

@ -268,6 +268,14 @@ public:
~ClientModelByScreenAndDesktop() override;
};
class ClientModelByScreenAndActivity : public ClientModel
{
Q_OBJECT
public:
ClientModelByScreenAndActivity(QObject *parent = nullptr);
~ClientModelByScreenAndActivity() override;
};
/**
* @brief Custom QSortFilterProxyModel to filter on Client caption, role and class.
*/