diff --git a/src/effects/presentwindows/presentwindows.cpp b/src/effects/presentwindows/presentwindows.cpp index 2a7f744f1e..6efe9f8b8f 100644 --- a/src/effects/presentwindows/presentwindows.cpp +++ b/src/effects/presentwindows/presentwindows.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -55,6 +56,7 @@ PresentWindowsEffect::PresentWindowsEffect() { initConfig(); + // TODO KF6 remove atom support auto announceSupportProperties = [this] { m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this); m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this); @@ -106,10 +108,17 @@ PresentWindowsEffect::PresentWindowsEffect() connect(effects, &EffectsHandler::screenAboutToLock, this, [this]() { setActive(false); }); + + QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/PresentWindows"), + QStringLiteral("org.kde.KWin.PresentWindows"), + this, + QDBusConnection::ExportScriptableSlots); + QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin.PresentWindows")); } PresentWindowsEffect::~PresentWindowsEffect() { + QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.KWin.PresentWindows")); delete m_filterFrame; delete m_closeView; } @@ -925,6 +934,21 @@ void PresentWindowsEffect::slotPropertyNotify(EffectWindow* w, long a) } } +void PresentWindowsEffect::presentWindows(const QStringList &windows) +{ + m_selectedWindows.clear(); + for (const auto &window : windows) { + if (auto effectWindow = effects->findWindow(QUuid(window)); effectWindow) { + m_selectedWindows.append(effectWindow); + } else if (auto effectWindow = effects->findWindow(window.toLong()); effectWindow) { + m_selectedWindows.append(effectWindow); + } + } + m_mode = ModeWindowGroup; + setActive(true); +} + + //----------------------------------------------------------------------------- // Window rearranging diff --git a/src/effects/presentwindows/presentwindows.h b/src/effects/presentwindows/presentwindows.h index e4870fcd0c..dc143715a1 100644 --- a/src/effects/presentwindows/presentwindows.h +++ b/src/effects/presentwindows/presentwindows.h @@ -184,6 +184,7 @@ public: return m_rightButtonDesktop; } public Q_SLOTS: + Q_SCRIPTABLE void presentWindows(const QStringList &windows); void setActive(bool active); void toggleActive() { m_mode = ModeCurrentDesktop;