From 267eb98fc3b92023c9acdd2c86808afadb86aa6e Mon Sep 17 00:00:00 2001 From: Bryan Date: Sun, 31 Dec 2023 17:46:19 -0600 Subject: [PATCH] First commit of widclkmod --- apps/widclkmod/.metadata.json.kate-swp | Bin 0 -> 141 bytes apps/widclkmod/ChangeLog | 1 + apps/widclkmod/metadata.json | 13 +++++++++++++ apps/widclkmod/widget.js | 19 +++++++++++++++++++ apps/widclkmod/widget.png | Bin 0 -> 422 bytes 5 files changed, 33 insertions(+) create mode 100644 apps/widclkmod/.metadata.json.kate-swp create mode 100644 apps/widclkmod/ChangeLog create mode 100644 apps/widclkmod/metadata.json create mode 100644 apps/widclkmod/widget.js create mode 100644 apps/widclkmod/widget.png diff --git a/apps/widclkmod/.metadata.json.kate-swp b/apps/widclkmod/.metadata.json.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..334f039856ff05043c34691bc1e41c5c5b6e29d8 GIT binary patch literal 141 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vn2~Ilrsmdk7^-SyZM|?3yK7~w3dKK&m xlwks5c_3y~aE0>~K>S<;UlGL5NAQ(E{1n&VARrCWuK>i#FvCC`=G^=gR{+ir7~=o{ literal 0 HcmV?d00001 diff --git a/apps/widclkmod/ChangeLog b/apps/widclkmod/ChangeLog new file mode 100644 index 000000000..dc18186e0 --- /dev/null +++ b/apps/widclkmod/ChangeLog @@ -0,0 +1 @@ +0.01: Forked from digital clock widget v0.08 and changed font. diff --git a/apps/widclkmod/metadata.json b/apps/widclkmod/metadata.json new file mode 100644 index 000000000..5362c1f27 --- /dev/null +++ b/apps/widclkmod/metadata.json @@ -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"} + ] +} diff --git a/apps/widclkmod/widget.js b/apps/widclkmod/widget.js new file mode 100644 index 000000000..cbafcdeb7 --- /dev/null +++ b/apps/widclkmod/widget.js @@ -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)); +}}; diff --git a/apps/widclkmod/widget.png b/apps/widclkmod/widget.png new file mode 100644 index 0000000000000000000000000000000000000000..5714ce274af7bdc62b8d8a9165fc9bc8a93bd820 GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(Fy?x?IEG|2zMbyh*JL2lF29*I z^f4z#gsP-MizbYNwW%YJF$eqy!$H(>ZPc)I$ztaD0e0sxq! ByZ-