Merge pull request #3966 from Trippnology/deko-optional-widgets

Deko: Add settings menu and make widgets optional
master^2
thyttan 2025-08-17 13:37:17 +02:00 committed by GitHub
commit 91a7d6edf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 108 additions and 35 deletions

View File

@ -1 +1,2 @@
0.01: first release
0.01: First release
0.02: Add setting to make widgets optional

View File

@ -1,10 +1,14 @@
# Deko Clock
A simple clock with an Art Deko font
A simple clock with an Art Deko font.
The font was obtained from https://dafonttop.com/building.font and is free for personal use
Widgets can be configured to be always on, always off, or only shown when unlocked.
The font was obtained from https://dafonttop.com/building.font and is free for personal use.
![](screenshot.png)
![](screenshot.png) ![](screenshot-no-widgets.png)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
Written by: [Hugh Barney](https://github.com/hughbarney)
Optional widgets settings added by [Trippnology](https://github.com/trippnology)
For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,21 @@
{
"id": "deko",
"name": "Deko Clock",
"version": "0.01",
"version": "0.02",
"description": "Clock with Art Deko font",
"readme": "README.md",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"screenshots": [
{ "url": "screenshot.png" },
{ "url": "screenshot-no-widgets.png" }
],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS","BANGLEJS2"],
"supports": ["BANGLEJS", "BANGLEJS2"],
"storage": [
{"name":"deko.app.js","url":"app.js"},
{"name":"deko.img","url":"app-icon.js","evaluate":true}
]
{ "name": "deko.app.js", "url": "app.js" },
{ "name": "deko.settings.js", "url": "settings.js" },
{ "name": "deko.img", "url": "app-icon.js", "evaluate": true }
],
"data": [{ "name": "deko.settings.json" }]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

32
apps/deko/settings.js Normal file
View File

@ -0,0 +1,32 @@
(function (back) {
const storage = require('Storage');
const settingsFile = 'deko.settings.json';
const defaultSettings = {
loadWidgets: 1,
};
const settings = Object.assign(
defaultSettings,
storage.readJSON(settingsFile, 1) || {},
);
const loadWidgetsChoices = ['No', 'Yes', 'Unlocked'];
const save = () => storage.write(settingsFile, settings);
const appMenu = {
'': { title: 'Deko Clock' },
'< Back': back,
'Load widgets?': {
value: settings.loadWidgets,
min: 0,
max: 2,
step: 1,
format: (v) => loadWidgetsChoices[v],
onchange: (v) => {
settings.loadWidgets = v;
save();
},
},
};
E.showMenu(appMenu);
})