1
0
Fork 0

Desktop Launcher: reset to clock after 2 mins of inactivity

master
fxiii 2021-07-11 21:13:18 +02:00
parent c882c52b27
commit fc0989ca41
3 changed files with 18 additions and 2 deletions

View File

@ -2667,7 +2667,7 @@
{ "id": "dtlaunch",
"name": "Desktop Launcher",
"icon": "icon.png",
"version":"0.03",
"version":"0.04",
"description": "Desktop style App Launcher with six apps per page - fast access if you have lots of apps installed.",
"readme": "README.md",
"tags": "tool,system,launcher",

View File

@ -1,4 +1,4 @@
0.01: Initial version
0.02: Multiple pages
0.03: cycle thru pages
0.04: reset to clock after 2 mins of inactivity

View File

@ -2,6 +2,20 @@
*
*/
function wdog(handle,timeout){
if(handle !== undefined){
wdog.handle = handle;
wdog.timeout = timeout;
}
if(wdog.timer){
clearTimeout(wdog.timer)
}
wdog.timer = setTimeout(wdog.handle,wdog.timeout)
}
// reset after two minutes of inactivity
wdog(load,120000)
var s = require("Storage");
var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type));
apps.sort((a,b)=>{
@ -42,6 +56,7 @@ function drawPage(p){
}
Bangle.on("swipe",(dir)=>{
wdog()
selected = 0;
oldselected=-1;
if (dir<0){
@ -54,6 +69,7 @@ Bangle.on("swipe",(dir)=>{
});
function nextapp(d){
wdog();
oldselected = selected;
selected+=d;
selected = selected<0?5:selected>5?0:selected;