Review of "Battery Power Monitor: Watts & Time" version 14 (7)

Details Page Preview

Battery Power Monitor - Shows percentage, time remaining, and watts in the GNOME Shell panel. Real-time power consumption monitoring with smart display options. v18: SYNCHRONOUS, VISUALS & CLEANUP MAJOR REFACTOR & STABILITY RELEASE Synchronous Core Architecture: The Change: We completely removed the asynchronous idle_add pattern used in v17. The UI updateUI function is now fully synchronous. Why Better (Determinism): Asynchronous updates introduced "desync" race conditions where the internal state (battery level) and visual state (icon) could drift apart during rapid changes. Sync updates ensure atomic consistency—what you see is exactly what the system reports, instantly. Trade-off Mitigation: While synchronous drawing on the main thread carries a risk of UI lag, we mitigated this by enforcing strict SVG Caching. Since heavy rendering is cached, the synchronous update is extremely lightweight (~microsecond scale), giving us the best of both worlds: instant updates with zero performance penalty. Global Visibility Logic Refactor: Previous Flaw: Hiding the indicator in v17 occasionally left "phantom" spacing or failed to override GNOME's native icon fully because the override hook wasn't strictly enforced. The Fix: The sync.js module now enforces a strict "nothing to show" contract. When "Hide when Charging" is active, the extension explicitly returns false to GNOME Shell's visibility checks, ensuring a cleaner panel layout. Modular Library Architecture: Refactor: We have moved away from the monolithic extension.js design. Core logic is now split into specific modules under extension/library/: drawing (Cairo/SVG), sync (GNOME overrides), indicators (Battery/Circle), system (Panel), and upower (Device). Why: This separation of concerns allows for safer feature additions, easier debugging, and reusable components (like the new Logger and Settings modules) without risking the stability of the main extension entry point. Memory Prevention Strategy: Refactor: Wired the v17 SVG_CACHE logic directly into the main update loop via purgeSvgCache(). Why: Caching without cleanup is just a memory leak by another name. v18 actively prunes unused surfaces (every 60s) and forces a deep clean on disable. This makes the extension robust enough for weeks of continuous runtime without bloating the heap. Visual Refinement: Centered Bolt: The charging bolt icon is now perfectly centered within the battery bar. Dynamic Text Sizing: Percentage text in the battery bar now adapts to both width and height, maximizing readability while preventing overflow on narrow configurations. Build & Integrity System: Schema Validation: Introduced .build-schema.json to enforce strict file inclusion rules. The build pipeline now recursively scans the extension/ directory and fails if any unknown or unexpected files are present. EGO Compliance: This mechanism guarantees that release artifacts are clean, containing only the files explicitly required by GNOME Shell, adhering to Extension.gnome.org (EGO) review guidelines. Cleanup: Renamed: scripts/ to .scripts/ screenshot/ to .screenshot/ Why: To de-clutter the root directory. Defaults: Updated default dimensions to 34x40 (Bar) and 36 (Circle) for better out-of-the-box aesthetics. Why: These dimensions provide a good balance between visibility and minimalism, ensuring the extension is both functional and aesthetically pleasing. Refactoring settings: Added icons and vertical settings panel to use the new Settings module. Why: This refactoring improves the maintainability and scalability of the settings panel, making it easier to add new options and features in the future. Upgrading the ESLint config: ESLint 9.0.0: Upgraded to the latest version of ESLint. Why: This upgrade ensures that the codebase adheres to the latest best practices and standards, improving code quality and maintainability. Upgrading the build pipeline: Why: This upgrade ensures that the codebase adheres to the latest best practices and standards, improving code quality and maintainability.

Extension Homepage
https://github.com/DarkPhilosophy/batt-watt-power-monitor

No comments.

Diff Against

Files

Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.

All Versions

Version Status
18 (12) Unreviewed
18 (11) Rejected
17 (10) Rejected
16 (9) Rejected
15 (8) Active
14 (7) Active
14 (6) Rejected
12 (5) Rejected
4 Rejected
3 Rejected
2 Rejected
1 Rejected

Previous Reviews on this Version

JustPerfection active
You can also add `donations` to the `metadata.json`, so people can donate to you if they want: [Extension Anatomy: donations](https://gjs.guide/extensions/overview/anatomy.html#donations)