Skip to content

Commit

Permalink
better init timer
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroxoneafour committed Mar 2, 2024
1 parent 5bfe219 commit 32b8af8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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();
Expand Down

0 comments on commit 32b8af8

Please sign in to comment.