diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 36b1439ad5..7e3e078c57 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -252,6 +252,7 @@ KWin::Scripting::Scripting(QObject *parent) QDBusConnection::sessionBus().registerObject("/Scripting", this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables); QDBusConnection::sessionBus().registerService("org.kde.kwin.Scripting"); connect(Workspace::self(), SIGNAL(configChanged()), SLOT(start())); + connect(Workspace::self(), SIGNAL(workspaceInitialized()), SLOT(start())); } void KWin::Scripting::start() diff --git a/workspace.cpp b/workspace.cpp index 926d83be63..5e1609ac2b 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -487,7 +487,6 @@ void Workspace::init() #ifdef KWIN_BUILD_SCRIPTING m_scripting = new Scripting(this); - m_scripting->start(); #endif // SELI TODO: This won't work with unreasonable focus policies, @@ -495,6 +494,9 @@ void Workspace::init() // want focus workspaceInit = false; + // broadcast that Workspace is ready, but first process all events. + QMetaObject::invokeMethod(this, "workspaceInitialized", Qt::QueuedConnection); + // TODO: ungrabXServer() } diff --git a/workspace.h b/workspace.h index 9c2d26f19a..2f1547fdcf 100644 --- a/workspace.h +++ b/workspace.h @@ -667,6 +667,11 @@ protected: Q_SIGNALS: Q_SCRIPTABLE void compositingToggled(bool active); + /** + * Emitted after the Workspace has setup the complete initialization process. + * This can be used to connect to for performing post-workspace initialization. + **/ + void workspaceInitialized(); //Signals required for the scripting interface signals: