timeout to clock copied from Icon Launcher
parent
84837228f9
commit
a46c76a2ff
|
|
@ -10,12 +10,18 @@ let settings = Object.assign({
|
||||||
direct: false,
|
direct: false,
|
||||||
oneClickExit: false,
|
oneClickExit: false,
|
||||||
swipeExit: false,
|
swipeExit: false,
|
||||||
|
timeOut: "Off"
|
||||||
}, require('Storage').readJSON("dtlaunch.json", true) || {});
|
}, require('Storage').readJSON("dtlaunch.json", true) || {});
|
||||||
|
|
||||||
if (settings.oneClickExit) {
|
if (settings.oneClickExit) {
|
||||||
var buttonWatch = setWatch(_=> returnToClock, BTN1);
|
var buttonWatch = setWatch(_=> returnToClock, BTN1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// taken from Icon Launcher with minor alterations
|
||||||
|
if (settings.timeOut!="Off"){
|
||||||
|
let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt
|
||||||
|
var timeoutToClock = setTimeout(returnToClock,time*1000);
|
||||||
|
}
|
||||||
let s = require("Storage");
|
let s = require("Storage");
|
||||||
var apps = s.list(/\.info$/).map(app=>{
|
var apps = s.list(/\.info$/).map(app=>{
|
||||||
let a=s.readJSON(app,1);
|
let a=s.readJSON(app,1);
|
||||||
|
|
@ -142,6 +148,9 @@ Bangle.on("touch",touchListenerDt);
|
||||||
const returnToClock = function() {
|
const returnToClock = function() {
|
||||||
Bangle.setUI();
|
Bangle.setUI();
|
||||||
clearWatch(buttonWatch);
|
clearWatch(buttonWatch);
|
||||||
|
delete buttonWatch;
|
||||||
|
clearTimeout(timeoutToClock);
|
||||||
|
delete timeoutToClock;
|
||||||
delete s;
|
delete s;
|
||||||
delete a;
|
delete a;
|
||||||
delete n;
|
delete n;
|
||||||
|
|
|
||||||
|
|
@ -6,50 +6,63 @@
|
||||||
showLaunchers: true,
|
showLaunchers: true,
|
||||||
direct: false,
|
direct: false,
|
||||||
oneClickExit:false,
|
oneClickExit:false,
|
||||||
swipeExit: false
|
swipeExit: false,
|
||||||
|
timeOut: "Off"
|
||||||
}, require('Storage').readJSON(FILE, true) || {});
|
}, require('Storage').readJSON(FILE, true) || {});
|
||||||
|
|
||||||
function writeSettings() {
|
function writeSettings() {
|
||||||
require('Storage').writeJSON(FILE, settings);
|
require('Storage').writeJSON(FILE, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
||||||
|
|
||||||
E.showMenu({
|
E.showMenu({
|
||||||
"" : { "title" : "Desktop launcher" },
|
"" : { "title" : "Desktop launcher" },
|
||||||
"< Back" : () => back(),
|
/*LANG*/"< Back" : () => back(),
|
||||||
'Show clocks': {
|
/*LANG*/'Show clocks': {
|
||||||
value: settings.showClocks,
|
value: settings.showClocks,
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.showClocks = v;
|
settings.showClocks = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Show launchers': {
|
/*LANG*/'Show launchers': {
|
||||||
value: settings.showLaunchers,
|
value: settings.showLaunchers,
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.showLaunchers = v;
|
settings.showLaunchers = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Direct launch': {
|
/*LANG*/'Direct launch': {
|
||||||
value: settings.direct,
|
value: settings.direct,
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.direct = v;
|
settings.direct = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Swipe Exit': {
|
/*LANG*/'Swipe Exit': {
|
||||||
value: settings.swipeExit,
|
value: settings.swipeExit,
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.swipeExit = v;
|
settings.swipeExit = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'One click exit': {
|
/*LANG*/'One click exit': {
|
||||||
value: settings.oneClickExit,
|
value: settings.oneClickExit,
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.oneClickExit = v;
|
settings.oneClickExit = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
/*LANG*/'Time Out': {
|
||||||
|
value: timeOutChoices.indexOf(settings.timeOut),
|
||||||
|
min: 0,
|
||||||
|
max: timeOutChoices.length-1,
|
||||||
|
format: v => timeOutChoices[v],
|
||||||
|
onchange: m => {
|
||||||
|
settings.timeOut = m;
|
||||||
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue