diff --git a/src/core/plasma-api/workspace.cpp b/src/core/plasma-api/workspace.cpp index f79decea..301ed380 100644 --- a/src/core/plasma-api/workspace.cpp +++ b/src/core/plasma-api/workspace.cpp @@ -58,6 +58,22 @@ QRect Workspace::clientArea(ClientAreaOption option, int screen, int desktop) BI_METHOD_IMPL_WRAP(QRect, "clientArea(ClientAreaOption, int, int)", Q_ARG(ClientAreaOption, option), Q_ARG(int, screen), Q_ARG(int, desktop)); }; +std::vector Workspace::clientList() const +{ + auto apiCall = [&]() -> QList { + BI_METHOD_IMPL_WRAP(QList, "clientList()", QGenericArgument(nullptr)); + }; + + auto apiCallRes = apiCall(); + + auto result = std::vector(apiCallRes.size()); + for (auto clientPtr : apiCallRes) { + result.push_back(Client(reinterpret_cast(clientPtr))); + } + + return result; +} + void Workspace::currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient) { // Since we don't know the KWin internal implementation we have to use reinterpret_cast diff --git a/src/core/plasma-api/workspace.hpp b/src/core/plasma-api/workspace.hpp index f7d17d06..d52e1441 100644 --- a/src/core/plasma-api/workspace.hpp +++ b/src/core/plasma-api/workspace.hpp @@ -55,6 +55,8 @@ public: */ Q_INVOKABLE QRect clientArea(ClientAreaOption, int screen, int desktop); + Q_INVOKABLE std::vector clientList() const; + private Q_SLOTS: void currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient); void clientAddedTransformer(KWin::AbstractClient *);