Battery session timer with record saving for GNOME Shell
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
EGO-X-004 warning
extensions should avoid synchronous file IO in shell code
Shell code should avoid synchronous file IO APIs like `GLib.file_get_contents()` and `Gio.File.load_contents()`.
extension.js:545
file.load_contents(null)
extension.js:571
file.load_contents(null)
extension.js:628
file.load_contents(null)
EGO-M-008 warning
extensions using unlock-dialog must document it in disable() comments
Extensions using `unlock-dialog` should document the reason in `disable()` comments.
extension.js:666
disable() {
this._proxyGeneration++;
this._logindGeneration++;
if (this._tracker) {
this._tracker.tick(this._nowUs());
const state = this._tracker.snapshot();
this._saveRecordIfDirty();
this._saveSessionState(state);
| Version | Status |
|---|---|
| 33 | Unreviewed |
| 32 | Rejected |
| 31 | Rejected |
| 30 | Rejected |
| 29 | Rejected |
| 28 | Rejected |
| 27 | Rejected |
| 26 | Rejected |
| 25 | Rejected |
| 24 | Rejected |
| 23 | Rejected |
| 22 | Rejected |
| 21 | Rejected |
| 20 | Rejected |
| 19 | Rejected |
| 18 | Rejected |
| 17 | Rejected |
| 16 | Rejected |
| 15 | Rejected |
| 14 | Rejected |
| 13 | Rejected |
| 12 | Rejected |
| 11 | Rejected |
| 10 | Rejected |
| 9 | Rejected |
| 8 | Rejected |
| 7 | Rejected |
| 6 | Rejected |
| 5 | Rejected |
| 4 | Rejected |
| 3 | Rejected |
| 2 | Rejected |
| 1 | Rejected |
Hello. Thank you for your continued guidance. I have carefully read and followed the best practices. Here is what I fixed: Removed all _enabled flags and unconditional early returns from disable(). Removed all unnecessary try-catch wrappers around disconnect() and Source.remove(). Moved _proxyGeneration++ and _logindGeneration++ to the beginning of disable(). Grouped timeout removal and creation together in _setPosition(). Removed all if (!this._enabled) checks from callbacks and lifecycle methods. I have uploaded version 9 (v9) with all fixes. Please let me know if there is anything else. Thanks!
Shexli issues need to be fixed. Also: https://gjs.guide/extensions/review-guidelines/best-practices.html#keep-the-default-entry-point-as-small-as-possible
Hello. Thank you for your continued guidance and thorough review. I have completely refactored the extension based on your feedback and the Best Practices guidelines. Here is a summary of all changes: ### 🏗️ Code Architecture - Split the monolithic `extension.js` into modular files: - `file-manager.js` – all file operations (async) - `power-manager.js` – UPower and logind management - `ui-manager.js` – panel indicator and menu - `core.js` – session tracker and utilities - The entry point (`extension.js`) is now small and focused (only lifecycle management) ### 🔧 Fixed Issues - **EGO-X-004**: Replaced all synchronous file I/O with async methods (`load_contents_async`) - **EGO-M-008**: Added comment explaining `unlock-dialog` usage in `disable()` - **EGO-A-004**: Reduced `console.error` calls to 2 (well below the limit of 5) - **Battery icon**: Fixed charge level display (no longer shows red at 76%) - **Initialization speed**: Indicator appears instantly, "Loading..." shown until UPower connects - **Power state reaction**: Update interval reduced to 1 second for faster response - **Best Practices**: - Removed `_enabled` flag - Removed empty `try-catch` blocks - Removed optional chaining for guaranteed methods - Split lines longer than 200 characters - Placed `enable()` and `disable()` close together - Removed all `console.log` statements - No emojis in code ### 📝 Documentation - README now includes both Russian and English versions - Added installation instructions for `gnome-extensions install` ### ✅ Quality Assurance - All checks in `check.sh` pass: **0 errors, 0 warnings** - Full compliance with EGO Review Guidelines and Best Practices ### 🚀 Release - Version 1.0.4 is available on GitHub: https://github.com/Gluk41/battery-session-timer/releases/tag/v1.0.4 - The extension has been uploaded to EGO for review Thank you for your patience. Please let me know if there is anything else I need to address.
Shexli issues fixed.