diff --git a/main.cpp b/main.cpp
index 7ad973208a..6055d49a30 100644
--- a/main.cpp
+++ b/main.cpp
@@ -42,10 +42,6 @@ along with this program. If not, see .
#include
#include
-#ifdef KWIN_BUILD_SCRIPTING
-#include "scripting/scripting.h"
-#endif
-
#include
#include
#include
@@ -525,9 +521,6 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
org::kde::KSMServerInterface ksmserver("org.kde.ksmserver", "/KSMServer", QDBusConnection::sessionBus());
ksmserver.suspendStartup("kwin");
KWin::Application a;
-#ifdef KWIN_BUILD_SCRIPTING
- KWin::Scripting scripting;
-#endif
ksmserver.resumeStartup("kwin");
KWin::SessionManager weAreIndeed;
@@ -550,9 +543,6 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
appname, QDBusConnectionInterface::DontQueueService);
KCmdLineArgs* sargs = KCmdLineArgs::parsedArgs();
-#ifdef KWIN_BUILD_SCRIPTING
- scripting.start();
-#endif
return a.exec();
}
diff --git a/workspace.cpp b/workspace.cpp
index 77dd708cde..b5fb7bb20c 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -61,6 +61,9 @@ along with this program. If not, see .
#include "overlaywindow.h"
#include
#include
+#ifdef KWIN_BUILD_SCRIPTING
+#include "scripting/scripting.h"
+#endif
#ifdef KWIN_BUILD_TILING
#include "tiling/tile.h"
#include "tiling/tilinglayout.h"
@@ -152,6 +155,7 @@ Workspace::Workspace(bool restore)
, transButton(NULL)
, forceUnredirectCheck(true)
, m_finishingCompositing(false)
+ , m_scripting(NULL)
{
(void) new KWinAdaptor(this);
@@ -470,6 +474,12 @@ void Workspace::init()
m_tiling->setEnabled(options->isTilingOn());
#endif
+
+#ifdef KWIN_BUILD_SCRIPTING
+ m_scripting = new Scripting(this);
+ m_scripting->start();
+#endif
+
// SELI TODO: This won't work with unreasonable focus policies,
// and maybe in rare cases also if the selected client doesn't
// want focus
diff --git a/workspace.h b/workspace.h
index 0dcb29c6e1..9c2d26f19a 100644
--- a/workspace.h
+++ b/workspace.h
@@ -86,6 +86,7 @@ class RootInfo;
class PluginMgr;
class Placement;
class Rules;
+class Scripting;
class WindowRules;
class Workspace : public QObject, public KDecorationDefines
@@ -896,6 +897,8 @@ private:
QTimer compositeResetTimer; // for compressing composite resets
bool m_finishingCompositing; // finishCompositing() sets this variable while shutting down
+ Scripting *m_scripting;
+
private:
friend bool performTransiencyCheck();
};