First commit of widclkmod

master
Bryan 2023-12-31 17:46:19 -06:00
parent f86dfe4569
commit 267eb98fc3
5 changed files with 33 additions and 0 deletions

Binary file not shown.

1
apps/widclkmod/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: Forked from digital clock widget v0.08 and changed font.

View File

@ -0,0 +1,13 @@
{
"id": "widclkmod",
"name": "Digital clock widget",
"version": "0.01",
"description": "A simple digital clock widget that appears when not showing a fullscreen clock. Forked from widclk.",
"icon": "widget.png",
"type": "widget",
"tags": "widget,clock",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"widclk.wid.js","url":"widget.js"}
]
}

19
apps/widclkmod/widget.js Normal file
View File

@ -0,0 +1,19 @@
/* Simple clock that appears in the widget bar if no other clock
is running. We update once per minute, but don't bother stopping
if the */
WIDGETS["wdclk"]={area:"tl",width:Bangle.CLOCK?0:52/* g.stringWidth("00:00") */,draw:function() {
if (!Bangle.CLOCK == !this.width) { // if we're the wrong size for if we have a clock or not...
this.width = Bangle.CLOCK?0:52;
return setTimeout(Bangle.drawWidgets,1); // widget changed size - redraw
}
if (!this.width) return; // if not visible, return
g.reset().g.setFont("6x8").setFontAlign(0,0);
var time = require("locale").time(new Date(),1);
g.clearRect(this.x, this.y, this.x+this.width-1, this.y+23).drawString(time, this.x+this.width/2, this.y+12); // 5 * 6*2 = 60
// queue draw in one minute
if (this.drawTimeout) clearTimeout(this.drawTimeout);
this.drawTimeout = setTimeout(()=>{
this.drawTimeout = undefined;
this.draw();
}, 60000 - (Date.now() % 60000));
}};

BIN
apps/widclkmod/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B