Changed approach per maintainer feedback - instead of caching signal values,
just add isInt() check before accessing config_["signal"].asInt() in refresh()
methods. This is simpler and more minimal.
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
Cache signal value during module construction to avoid accessing JSON config
in signal handler context. This prevents crashes when signal field is missing
or not an integer type.
- Custom module: Cache signal_ value in constructor
- Image module: Cache signal_ value in constructor
- Both modules: Use cached value in refresh() method
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
The current documentation for the custom module suggests mixing manual
(`{icon}`) and automatic (`{}`) indexing of format args. Newer versions
of the fmt library seem to not support this anymore (see issue #3605).
This commit introduces a name for the `text` output of the script, so
that `{text}` can now be used instead of `{}` in the configuration.
Previously, the only way to select all the module labels was with the
following kind of selector:
```css
.modules-left > widget > label,
.modules-center > widget > label,
.modules-right > widget > label {
/* ... */
}
```
(and a matching block for the `box` containers).
Now, this can be expressed as
```css
label.module, box.module {
/* ... */
}
```
This reverts commit 2d33c20231 and
reapplies various patches for memory leaks.
The reason for the revert was a bug for a maximum duration interval
which caused sleep_for() to cause unpredictable behavior.
There were two main issues with fmtlib and C++20 mode:
- `fmt::format` defaults to compile-time argument checking and requires
using `fmt::runtime(format_string)` to bypass that.
- `std::format` implementation introduces conflicting declarations and
we have to specify the namespace for all `format`/`format_to` calls.