From ac7ed7dc906d99baad0701b90705ae0c3698af4e Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Wed, 13 Nov 2024 21:56:05 +0100 Subject: [PATCH] quicklaunch: undo timeout, load settings on demand --- apps/quicklaunch/boot.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/quicklaunch/boot.js b/apps/quicklaunch/boot.js index 5277417ce..5c4f9b88c 100644 --- a/apps/quicklaunch/boot.js +++ b/apps/quicklaunch/boot.js @@ -1,15 +1,18 @@ { -setTimeout(() => { // wrap in zero ms timeout so the foreground app loads first. const storage = require("Storage"); - let settings = storage.readJSON("quicklaunch.json", true) || {}; + let settings; let leaveTrace = function(trace) { + if (!settings) settings = storage.readJSON("quicklaunch.json", true) || {}; + settings.trace = trace; storage.writeJSON("quicklaunch.json", settings); return trace; }; let launchApp = function(trace) { + if (!settings) settings = storage.readJSON("quicklaunch.json", true) || {}; + if (settings[trace+"app"].src){ if (settings[trace+"app"].name == "Show Launcher") Bangle.showLauncher(); else if (!storage.read(settings[trace+"app"].src)) { @@ -41,5 +44,4 @@ setTimeout(() => { // wrap in zero ms timeout so the foreground app loads first. if (ud == 1) trace = leaveTrace("d"); // d=down. launchApp(trace); }); -}, 0); }