diff --git a/apps/widminbate/ChangeLog b/apps/widminbate/ChangeLog index d4143d802..c1952a33d 100644 --- a/apps/widminbate/ChangeLog +++ b/apps/widminbate/ChangeLog @@ -1,3 +1,5 @@ 0.01: Initial Version: Display at under 30% battery 0.02: Display while charging 0.03: Do not clear outside of widget bar +0.04: Fork `widminbat`->`widminbate`. Only use the system theme foreground + colour. diff --git a/apps/widminbate/metadata.json b/apps/widminbate/metadata.json index 7aa200282..dfa5a69fa 100644 --- a/apps/widminbate/metadata.json +++ b/apps/widminbate/metadata.json @@ -1,13 +1,13 @@ -{ "id": "widminbat", - "name": "Minimal Battery", - "shortName":"MinBat", - "version":"0.03", - "description": "A minimal version of the battery widget that only appears if the battery is running low (below 30%)", +{ "id": "widminbate", + "name": "Extra Minimal Battery", + "shortName":"ExtraMinBat", + "version":"0.04", + "description": "An extra minimal (only use system theme foreground colour) version of the battery widget that only appears if the battery is running low (below 30%)", "icon": "widget.png", "type": "widget", - "tags": "widget,battery,minimal", + "tags": "widget,battery,minimal,monochrome", "supports" : ["BANGLEJS2", "BANGLEJS"], "storage": [ - {"name":"widminbat.wid.js","url":"widget.js"} + {"name":"widminbate.wid.js","url":"widget.js"} ] } diff --git a/apps/widminbate/widget.js b/apps/widminbate/widget.js index 27453f7cd..0bf4ceee3 100644 --- a/apps/widminbate/widget.js +++ b/apps/widminbate/widget.js @@ -2,18 +2,16 @@ function getWidth() { return E.getBattery() <= 30 || Bangle.isCharging() ? 40 : 0; } - WIDGETS.minbat={area:"tr",width:getWidth(),draw:function() { + WIDGETS.minbate={area:"tr",width:getWidth(),draw:function() { if(this.width < 40) return; var s = 39; var bat = E.getBattery(); var x = this.x, y = this.y; - g.reset(); - g.clearRect(x,y,x+s,y+23); - g.setColor(g.theme.fg).fillRect(x,y+2,x+s-4,y+21).clearRect(x+2,y+4,x+s-6,y+19).fillRect(x+s-3,y+10,x+s,y+14); var barWidth = bat*(s-12)/100; - var color = bat < 15 ? "#f00" : (bat <= 30 ? "#f80" : "#0f0"); - g.setColor(color).fillRect(x+4,y+6,x+4+barWidth,y+17); - },update: function() { + g.reset(). + clearRect(x,y,x+s,y+23). + setColor(g.theme.fg).fillRect(x,y+2,x+s-4,y+21).clearRect(x+2,y+4,x+s-6,y+19).fillRect(x+s-3,y+10,x+s,y+14).//border + fillRect(x+4,y+6,x+4+barWidth,y+17);//indicator bar var newWidth = getWidth(); if(newWidth != this.width) { this.width = newWidth; @@ -23,8 +21,8 @@ } }}; setInterval(()=>{ - var widget = WIDGETS.minbat; + var widget = WIDGETS.minbate; if(widget) {widget.update();} }, 10*60*1000); - Bangle.on('charging', () => WIDGETS.minbat.update()); + Bangle.on('charging', () => WIDGETS.minbate.update()); })(); diff --git a/apps/widminbate/widget.png b/apps/widminbate/widget.png index b04bc4ef9..9084a09d1 100644 Binary files a/apps/widminbate/widget.png and b/apps/widminbate/widget.png differ