Gordon Williams 2022-11-30 09:55:02 +00:00
parent 1777799ae6
commit 45c5e15f20
7 changed files with 30 additions and 12 deletions

View File

@ -4,3 +4,4 @@
0.04: Set sortorder to -1 so that widget always takes up the furthest left position 0.04: Set sortorder to -1 so that widget always takes up the furthest left position
0.05: Set sortorder to -10 so that others can take -1 etc 0.05: Set sortorder to -10 so that others can take -1 etc
0.06: Set sortorder to -10 in widget code 0.06: Set sortorder to -10 in widget code
0.07: Remove check for .isLocked (extremely old firmwares), speed up widget loading

View File

@ -1,7 +1,7 @@
{ {
"id": "widlock", "id": "widlock",
"name": "Lock Widget", "name": "Lock Widget",
"version": "0.06", "version": "0.07",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked", "description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked",
"icon": "widget.png", "icon": "widget.png",
"type": "widget", "type": "widget",

View File

@ -1,6 +1,4 @@
(function(){ Bangle.on("lock", function() {
if (!Bangle.isLocked) return; // bail out on old firmware
Bangle.on("lock", function(on) {
WIDGETS["lock"].width = Bangle.isLocked()?16:0; WIDGETS["lock"].width = Bangle.isLocked()?16:0;
Bangle.drawWidgets(); Bangle.drawWidgets();
}); });
@ -8,4 +6,3 @@
if (Bangle.isLocked()) if (Bangle.isLocked())
g.reset().drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), w.x+1, w.y+4); g.reset().drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), w.x+1, w.y+4);
}}; }};
})()

View File

@ -0,0 +1 @@
0.01: First commit

View File

@ -0,0 +1,13 @@
{
"id": "widlockunlock",
"name": "Lock/Unlock Widget",
"version": "0.01",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked, or an unlock icon otherwise",
"icon": "widget.png",
"type": "widget",
"tags": "widget,lock",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"widlockunlock.wid.js","url":"widget.js"}
]
}

View File

@ -0,0 +1,6 @@
Bangle.on("lockunlock", function() {
Bangle.drawWidgets();
});
WIDGETS["lockunlock"]={area:"tl",sortorder:10,width:14,draw:function(w) {
g.reset().drawImage(atob(Bangle.isLocked() ? "DBGBAAAA8DnDDCBCBP////////n/n/n//////z/A" : "DBGBAAAA8BnDDCBABP///8A8A8Y8Y8Y8A8A//z/A"), w.x+1, w.y+3);
}};

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B