From 21d7bbd6c48506f4d7e42e0df6576489c319e7de Mon Sep 17 00:00:00 2001 From: Peter Fajdiga Date: Sun, 10 Mar 2024 14:53:57 +0100 Subject: [PATCH] DesktopManager: don't yield previously unconstructed desktops --- src/world/DesktopManager.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/world/DesktopManager.ts b/src/world/DesktopManager.ts index 2f0c54c..e04feff 100644 --- a/src/world/DesktopManager.ts +++ b/src/world/DesktopManager.ts @@ -74,7 +74,11 @@ class DesktopManager { const clientDesktops = kwinClient.desktops.length > 0 ? kwinClient.desktops : this.kwinDesktops.keys(); for (const clientActivity of clientActivities) { for (const clientDesktop of clientDesktops) { - yield this.getDesktop(clientActivity, clientDesktop); + const desktopKey = DesktopManager.getDesktopKey(clientActivity, clientDesktop); + const desktop = this.desktops.get(desktopKey); + if (desktop !== undefined) { + yield desktop; + } } } } @@ -83,9 +87,13 @@ class DesktopManager { public *getDesktops(activities: string[], kwinDesktops: KwinDesktop[]) { const matchedActivities = activities.length > 0 ? activities : this.kwinActivities.keys(); const matchedDesktops = kwinDesktops.length > 0 ? kwinDesktops : this.kwinDesktops.keys(); - for (const clientActivity of matchedActivities) { - for (const clientDesktop of matchedDesktops) { - yield this.getDesktop(clientActivity, clientDesktop); + for (const matchedActivity of matchedActivities) { + for (const matchedDesktop of matchedDesktops) { + const desktopKey = DesktopManager.getDesktopKey(matchedActivity, matchedDesktop); + const desktop = this.desktops.get(desktopKey); + if (desktop !== undefined) { + yield desktop; + } } } }