diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index e99d9b0d9b..35ef346d8d 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -22,6 +22,8 @@ along with this program. If not, see . #include "workspace_wrapper.h" #include "../client.h" +#include + namespace KWin { WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) @@ -35,6 +37,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) connect(ws, SIGNAL(clientActivated(KWin::Client*)), SIGNAL(clientActivated(KWin::Client*))); connect(ws, SIGNAL(numberDesktopsChanged(int)), SIGNAL(numberDesktopsChanged(int))); connect(ws, SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)), SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool))); + connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SIGNAL(numberScreensChanged(int))); foreach (KWin::Client *client, ws->clientList()) { setupClientConnections(client); } diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h index de2ce9075d..d2752210dc 100644 --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -61,7 +61,7 @@ class WorkspaceWrapper : public QObject **/ Q_PROPERTY(int displayHeight READ displayHeight) Q_PROPERTY(int activeScreen READ activeScreen) - Q_PROPERTY(int numScreens READ numScreens) + Q_PROPERTY(int numScreens READ numScreens NOTIFY numberScreensChanged) private: Q_DISABLE_COPY(WorkspaceWrapper) @@ -92,6 +92,11 @@ signals: * @param set New value of demands attention **/ void clientDemandsAttentionChanged(KWin::Client *client, bool set); + /** + * Signal emitted when the number of screens changes. + * @param count The new number of screens + **/ + void numberScreensChanged(int count); public: //------------------------------------------------------------------