scripting: Add desktops property to AbstractClient
With the new virtual desktops model, a window can be on several virtual desktops. Currently, scripts have no any way to get the list of desktops the window is on. This change addresses that.
This commit is contained in:
parent
fc52531f44
commit
9a2a1c0435
2 changed files with 11 additions and 0 deletions
|
@ -75,9 +75,16 @@ class KWIN_EXPORT AbstractClient : public Toplevel
|
|||
/**
|
||||
* The desktop this Client is on. If the Client is on all desktops the property has value -1.
|
||||
* This is a legacy property, use x11DesktopIds instead
|
||||
*
|
||||
* @deprecated Use the desktops property instead.
|
||||
*/
|
||||
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
||||
|
||||
/**
|
||||
* The virtual desktops this client is on. If it's on all desktops, the list is empty.
|
||||
*/
|
||||
Q_PROPERTY(QVector<KWin::VirtualDesktop *> desktops READ desktops WRITE setDesktops NOTIFY desktopChanged)
|
||||
|
||||
/**
|
||||
* Whether the Client is on all desktops. That is desktop is -1.
|
||||
*/
|
||||
|
@ -90,6 +97,8 @@ class KWIN_EXPORT AbstractClient : public Toplevel
|
|||
|
||||
/**
|
||||
* The x11 ids for all desktops this client is in. On X11 this list will always have a length of 1
|
||||
*
|
||||
* @deprecated prefer using apis that use VirtualDesktop objects
|
||||
*/
|
||||
Q_PROPERTY(QVector<uint> x11DesktopIds READ x11DesktopIds NOTIFY x11DesktopIdsChanged)
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "input.h"
|
||||
#include "options.h"
|
||||
#include "screenedge.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "workspace.h"
|
||||
#include "x11client.h"
|
||||
// KDE
|
||||
|
@ -656,6 +657,7 @@ void KWin::Scripting::init()
|
|||
});
|
||||
|
||||
qmlRegisterType<KWin::AbstractClient>();
|
||||
qmlRegisterType<KWin::VirtualDesktop>();
|
||||
qmlRegisterType<KWin::X11Client>();
|
||||
qmlRegisterType<QAbstractItemModel>();
|
||||
|
||||
|
|
Loading…
Reference in a new issue