diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp index 5894d94b5d..39f3247b49 100644 --- a/src/scripting/scripting.cpp +++ b/src/scripting/scripting.cpp @@ -659,16 +659,18 @@ void KWin::Scripting::init() Q_UNUSED(jsEngine) return new DeclarativeScriptWorkspaceWrapper(); }); + qmlRegisterSingletonInstance("org.kde.kwin", 3, 0, "Options", options); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); + // TODO Plasma 6: Drop context properties. m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("workspace"), m_workspaceWrapper); m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("options"), options); - m_declarativeScriptSharedContext->setContextProperty(QStringLiteral("workspace"), new DeclarativeScriptWorkspaceWrapper(this)); + // QQmlListProperty interfaces only work via properties, rebind them as functions here QQmlExpression expr(m_declarativeScriptSharedContext, nullptr, "workspace.clientList = function() { return workspace.clients }"); expr.evaluate();