• I have tried your code @Sir_Indy with Imageclock and Iconlauncher and like it a lot. Much better than my own swiping-to-show-widgets hack.
    Some things still to consider:
    setUI currently does not clean up the Bangle.CLOCK marker variable, so Bangle.CLOCK stays once there was a setUI with a clock mode.
    Just deleting this in setUI does not solve the problem though, since there are widgets, that differentiate their behaviour during loadWidgets. An example would be the widclk, which just does nothing in case of Bangle.CLOCK.

    I have done the change to delete Bangle.CLOCK in the Espruino repo, but could not find documentation on how to create the minimized variants of the scripts.

    Those widgets need some kind of way to be selectively reloaded on change of Bangle.CLOCK.
    Some ideas of the top of my head:

    1. Remove the check and once again load all widgets on every call to loadWidgets. Slow and not great, but easy and backwards compatible.
    2. Change widgets using this style to check during draw for Bangle.CLOCK and just hide themselves on clocks. Fast, but uses more memory on clocks since the widget will be loaded.
      2b. Have widgets have an update method to be called by setUI if available to notify them to check for changes as Bangle.CLOCK.
    3. Somehow identify widgets not used on clocks during the initial load. Then after change of Bangle.CLOCK load only the missing widgets during loadWidgets. Maybe widgets could be un/loaded depending on some metadata.json entry to match the current Bangle.CLOCK state?


About

Avatar for halemmerich @halemmerich started