diff --git a/apps/widbthide/metadata.json b/apps/widbthide/metadata.json new file mode 100644 index 000000000..59b13adb4 --- /dev/null +++ b/apps/widbthide/metadata.json @@ -0,0 +1,13 @@ +{ + "id": "widbthide", + "name": "Bluetooth Widget (hides when no connection)", + "version": "0.01", + "description": "Shows Bluetooth icon (when connected) in the top right of the clock", + "icon": "widget.png", + "type": "widget", + "tags": "widget,bluetooth", + "supports": ["BANGLEJS","BANGLEJS2"], + "storage": [ + {"name":"widbthide.wid.js","url":"widget.js"} + ] +} diff --git a/apps/widbthide/widget.js b/apps/widbthide/widget.js new file mode 100644 index 000000000..620811b36 --- /dev/null +++ b/apps/widbthide/widget.js @@ -0,0 +1,13 @@ +WIDGETS["bluetooth"]={area:"tr",draw:function() { + if (WIDGETS.bluetooth.width==0) + return; + g.reset(); + g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f")); + g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),2+this.x,2+this.y); +},changed:function() { + WIDGETS.bluetooth.width = NRF.getSecurityStatus().connected?15:0; + Bangle.drawWidgets(); +},width:NRF.getSecurityStatus().connected?15:0 +}; +NRF.on('connect',WIDGETS.bluetooth.changed); +NRF.on('disconnect',WIDGETS.bluetooth.changed); diff --git a/apps/widbthide/widget.png b/apps/widbthide/widget.png new file mode 100644 index 000000000..1a884a62c Binary files /dev/null and b/apps/widbthide/widget.png differ