app: init services after timeout

Prevent's startup delay on slower machines (yes, even with idle)
This commit is contained in:
2 * r + 2 * t 2025-03-05 00:13:43 +11:00
parent 999f295a78
commit 9d1ee02d2e

View file

@ -10,7 +10,7 @@ import Players from "@/services/players";
import Schemes from "@/services/schemes"; import Schemes from "@/services/schemes";
import Wallpapers from "@/services/wallpapers"; import Wallpapers from "@/services/wallpapers";
import type PopupWindow from "@/widgets/popupwindow"; import type PopupWindow from "@/widgets/popupwindow";
import { execAsync, idle, writeFileAsync } from "astal"; import { execAsync, idle, timeout, writeFileAsync } from "astal";
import { App } from "astal/gtk3"; import { App } from "astal/gtk3";
import { initConfig, updateConfig } from "config"; import { initConfig, updateConfig } from "config";
@ -41,8 +41,10 @@ App.start({
<Popdowns />; <Popdowns />;
// Init services // Init services
timeout(1000, () => {
idle(() => Schemes.get_default()); idle(() => Schemes.get_default());
idle(() => Wallpapers.get_default()); idle(() => Wallpapers.get_default());
});
console.log(`Caelestia started in ${Date.now() - now}ms`); console.log(`Caelestia started in ${Date.now() - now}ms`);
}, },