setting - Adds setting for launcher

pull/2182/head
Martin Boonk 2022-10-20 19:24:06 +02:00
parent 72208c2c06
commit 13d17b25a6
1 changed files with 30 additions and 0 deletions

View File

@ -87,6 +87,7 @@ function showSystemMenu() {
/*LANG*/'LCD': ()=>showLCDMenu(),
/*LANG*/'Locale': ()=>showLocaleMenu(),
/*LANG*/'Select Clock': ()=>showClockMenu(),
/*LANG*/'Select Launcher': ()=>showLauncherMenu(),
/*LANG*/'Date & Time': ()=>showSetTimeMenu()
};
@ -671,6 +672,35 @@ function showClockMenu() {
}
return E.showMenu(clockMenu);
}
function showLauncherMenu() {
var launcherApps = require("Storage").list(/\.info$/)
.map(app => {var a=storage.readJSON(app, 1);return (a&&a.type == "launch")?a:undefined})
.filter(app => app) // filter out any undefined apps
.sort((a, b) => a.sortorder - b.sortorder);
const launcherMenu = {
'': {
'title': /*LANG*/'Select Launcher',
},
'< Back': ()=>showSystemMenu(),
};
launcherApps.forEach((app, index) => {
var label = app.name;
if ((!settings.launcher && index === 0) || (settings.launcher === app.src)) {
label = "* " + label;
}
launcherMenu[label] = () => {
if (settings.launcher !== app.src) {
settings.launcher = app.src;
updateSettings();
showMainMenu();
}
};
});
if (launcherApps.length === 0) {
launcherMenu[/*LANG*/"No Launchers Found"] = () => { };
}
return E.showMenu(launcherMenu);
}
function showSetTimeMenu() {
d = new Date();