From 32b8af8a65242e2f213c268ac4be9101321b0130 Mon Sep 17 00:00:00 2001 From: Vaughan Milliman Date: Sat, 2 Mar 2024 00:00:19 -0600 Subject: [PATCH] better init timer --- src/controller/index.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/controller/index.ts b/src/controller/index.ts index f178a48..77e6afe 100644 --- a/src/controller/index.ts +++ b/src/controller/index.ts @@ -71,7 +71,7 @@ export class Controller { // delayed init will help with some stuff this.initTimer = qmlObjects.root.createTimer(); - this.initTimer.interval = 1000; + this.initTimer.interval = 100; this.initTimer.triggered.connect(this.initCallback.bind(this)); this.initTimer.repeat = false; } @@ -81,6 +81,18 @@ export class Controller { } private initCallback(): void { + // keep restarting the call until it actually initializes properly + if ( + this.workspace.activities.length == 1 && + this.workspace.activities[0] == + "00000000-0000-0000-0000-000000000000" + ) { + this.logger.debug("Restarting init timer"); + // gradually increase time between restart calls for slower systems + this.initTimer.interval += 100; + this.initTimer.restart(); + return; + } // hook into kwin after everything loads nicely this.workspaceActions.addHooks(); this.driverManager.init();