A simple GNOME Shell extension that shows how long your system has been running on battery power since it was last unplugged.
It adds a small label to your top bar that updates automatically and displays:
- Time since last unplugged (e.g.,
1h 23m) - Starting battery percentage
- Estimated remaining runtime
-
Displays time since last unplugged in the top bar
-
Popup shows detailed battery info:
- Duration on battery
- Start percentage
- Estimated remaining time
-
Lightweight — updates every minute
-
Uses native GNOME UI components for a clean look
-
Clone this repository:
git clone https://github.com/moser4035/gse-battery-runtime.git
-
Copy the extension folder to your GNOME extensions directory:
mkdir -p ~/.local/share/gnome-shell/extensions/ cp -r gse-battery-runtime/[email protected] ~/.local/share/gnome-shell/extensions/
-
Restart GNOME Shell:
- On X11:
Alt + F2, typer, and press Enter - On Wayland: log out and back in
- On X11:
-
Enable the extension:
gnome-extensions enable [email protected]
| GNOME Shell | Status |
|---|---|
| 42 | ✅ Supported |
| 45 | 🟡 Planned |
| 46 | 🟡 Planned |
The extension uses the UPower system API to track when the system switches between AC and battery power. When unplugged, it records the timestamp and battery level, then calculates how long the system has been running since that moment.
It stores this state in:
~/.cache/battery-runtime/state.json
To reload the extension after code changes:
gnome-extensions disable [email protected]
gnome-extensions enable [email protected]To view logs:
journalctl -f -o cat /usr/bin/gnome-shell-
Zip only the contents of the extension folder (not the parent repo):
cd ~/.local/share/gnome-shell/extensions/[email protected]/ zip -r ../[email protected] *
-
Upload the ZIP file to extensions.gnome.org.
MIT License © 2025 moser4035