added settings for cutelauncher

master
kkayam 2025-02-16 14:31:37 +00:00
parent a80ae53a7c
commit c91c061b48
3 changed files with 53 additions and 11 deletions

View File

@ -2,10 +2,9 @@
let settings = Object.assign(
{
showClocks: false,
showLaunchers: false,
timeOut: 10,
scrollbar: true
},
require('Storage').readJSON('cutelauncher.json', true) || {}
require('Storage').readJSON('cutelauncher.setting.json', true) || {}
);
let s = require('Storage');
@ -183,13 +182,15 @@
}
});
// Update scroll indicator on drag
const updateOnDrag = () => updateScrollIndicator(scroller.scroll);
Bangle.on('drag', updateOnDrag);
// Initialize the scroll indicator
initScrollIndicator();
// Initial update of scroll indicator
updateScrollIndicator(scroller.scroll);
if (settings.scrollbar) {
// Update scroll indicator on drag
const updateOnDrag = () => updateScrollIndicator(scroller.scroll);
Bangle.on('drag', updateOnDrag);
// Initialize the scroll indicator
initScrollIndicator();
// Initial update of scroll indicator
updateScrollIndicator(scroller.scroll);
}
setWatch(Bangle.showClock, BTN1, { debounce: 100 });
// Add lock handler to show clock when locked

View File

@ -1,7 +1,7 @@
{
"id": "cutelauncher",
"name": "Cute Launcher",
"version": "0.18",
"version": "0.19",
"description": "A simple launcher app for Bangle.js 2 that makes use of the full touchscreen",
"icon": "app.png",
"type": "launch",
@ -18,6 +18,10 @@
"name": "cutelauncher.img",
"url": "app-icon.js",
"evaluate": true
},
{
"name": "cutelauncher.setting.json",
"url": "settings.js"
}
]
}

View File

@ -0,0 +1,37 @@
(function (back) {
const SETTINGS_FILE = "cutelauncher.setting.json";
// initialize with default settings...
const storage = require('Storage');
let settings = {
showClocks: false,
scrollbar: true
};
let saved_settings = storage.readJSON(SETTINGS_FILE, 1) || settings;
for (const key in saved_settings) {
settings[key] = saved_settings[key];
}
function save() {
storage.write(SETTINGS_FILE, settings);
}
E.showMenu({
'': { 'title': 'Cutelauncher' },
'< Back': back,
'Show Clocks': {
value: settings.smallNumeralClock,
onchange: () => {
settings.showClocks = !settings.showClocks;
save();
}
},
'Scrollbar': {
value: settings.smallNumeralClock,
onchange: () => {
settings.scrollbar = !settings.scrollbar;
save();
}
}
});
});