From c06c840b29debf0199fa5d2c6985aed8564a4c9e Mon Sep 17 00:00:00 2001 From: Mikhail Zolotukhin Date: Thu, 24 Mar 2022 23:25:53 +0300 Subject: [PATCH] refactor: port desktops workspace function --- src/core/plasma-api/workspace.hpp | 1 + src/kwinscript/driver/index.ts | 4 ---- src/kwinscript/driver/surface.ts | 4 +--- src/kwinscript/driver/window.ts | 3 --- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/core/plasma-api/workspace.hpp b/src/core/plasma-api/workspace.hpp index b3f2d7c0..7fbdefc7 100644 --- a/src/core/plasma-api/workspace.hpp +++ b/src/core/plasma-api/workspace.hpp @@ -39,6 +39,7 @@ public: BI_PROPERTY(int, currentDesktop, setCurrentDesktop); BI_PROPERTY(QString, currentActivity, setCurrentActivity); + BI_PROPERTY(int, desktops, setDesktops); /** * Returns the geometry a Client can use with the specified option. diff --git a/src/kwinscript/driver/index.ts b/src/kwinscript/driver/index.ts index 416db17f..a5aeba45 100644 --- a/src/kwinscript/driver/index.ts +++ b/src/kwinscript/driver/index.ts @@ -70,7 +70,6 @@ export class DriverImpl implements Driver { this.proxy.workspace().currentActivity, this.proxy.workspace().currentDesktop, this.qml.activityInfo, - this.kwinApi, this.config, this.proxy ); @@ -110,7 +109,6 @@ export class DriverImpl implements Driver { this.proxy.workspace().currentActivity, this.proxy.workspace().currentDesktop, this.qml.activityInfo, - this.kwinApi, this.config, this.proxy ) @@ -157,7 +155,6 @@ export class DriverImpl implements Driver { new DriverWindowImpl( client, this.qml, - this.kwinApi, this.config, this.log, this.proxy @@ -182,7 +179,6 @@ export class DriverImpl implements Driver { this.proxy.workspace().currentActivity, this.proxy.workspace().currentDesktop, this.qml.activityInfo, - this.kwinApi, this.config, this.proxy ); diff --git a/src/kwinscript/driver/surface.ts b/src/kwinscript/driver/surface.ts index 51628797..12b7ee8e 100644 --- a/src/kwinscript/driver/surface.ts +++ b/src/kwinscript/driver/surface.ts @@ -44,7 +44,6 @@ export class DriverSurfaceImpl implements DriverSurface { public readonly activity: string, public readonly desktop: number, private activityInfo: Plasma.TaskManager.ActivityInfo, - private kwinApi: KWin.Api, private config: Config, private proxy: TSProxy ) { @@ -66,7 +65,7 @@ export class DriverSurfaceImpl implements DriverSurface { public next(): DriverSurface | null { // This is the last virtual desktop - if (this.desktop === this.kwinApi.workspace.desktops) { + if (this.desktop === this.proxy.workspace().desktops) { return null; } @@ -75,7 +74,6 @@ export class DriverSurfaceImpl implements DriverSurface { this.activity, this.desktop + 1, this.activityInfo, - this.kwinApi, this.config, this.proxy ); diff --git a/src/kwinscript/driver/window.ts b/src/kwinscript/driver/window.ts index 872661bf..2377419d 100644 --- a/src/kwinscript/driver/window.ts +++ b/src/kwinscript/driver/window.ts @@ -181,7 +181,6 @@ export class DriverWindowImpl implements DriverWindow { activity, desktop, this.qml.activityInfo, - this.kwinApi, this.config, this.proxy ); @@ -205,14 +204,12 @@ export class DriverWindowImpl implements DriverWindow { * * @param client the client the window represents * @param qml root qml object of the script - * @param kwinApi * @param config * @param log */ constructor( public readonly client: KWin.Client, private qml: Bismuth.Qml.Main, - private kwinApi: KWin.Api, private config: Config, private log: Log, private proxy: TSProxy