• Something like that would be very nice!
    Some thoughts:

    • Does it have to be a function? Could maybe just be Bangle.APP, as we already have Bangle.WIDGETS?
    • When would it be allowed to change? I'm thinking only when calling Bangle.loadWidgets().
    • x,y,w,h looks nice, but if something is called *Rect I would expect x1,y1,x2,y2, like g.fillRect().
    • Also: x,y,w,h feels neater, but will make apps calculate a lot of x+w-1, whereas x2 wouldn't have the off-by-one problems, from the above example:

      var dim = Bangle.getAppRect();
      g.clearRect(dim.x, dim.y, dim.w, dim.h); // wrong
      g.clearRect(dim.x, dim.y, dim.w, dim.h + dim.y); // also wrong :-(
      g.clearRect(dim.x, dim.y, dim.x + dim.w - 1, dim.h + dim.y -1 ); // correct
      // vs
      g.clearRect(dim.x1, dim.y1, dim.x2, dim.y2);
      

      Same goes for

      var app = Bangle.getAppRect();
      g.setFontAlign(1, 1); // right,bottom
      g.drawString('bottom right', app.x+app.w-1, app.y+app.h-1);
      // vs
      g.drawString('bottom right', app.x2, app.y2);
      
About

Avatar for rigrig @rigrig started