Skip to content

Grow the power panel's charge bar into a chart of the last six hours - #17395

Open
yamz8 wants to merge 9 commits into
omacom:quattrofrom
yamz8:power-panel-charge-history
Open

yamz8 wants to merge 9 commits into
omacom:quattrofrom
yamz8:power-panel-charge-history

Conversation

@yamz8

@yamz8 yamz8 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

The power panel shows where the battery is now, but not how it got there, so "how fast am I draining?" means watching the percentage over time. UPower already keeps each battery's charge history on disk; this grows the panel's charge bar into a chart of the last six hours of it.

  • The chart takes the charge bar's place with the same fill colour and charging pulse, a little taller (24px): 36 columns, one per ten minutes, each filled to the level at the end of its ten minutes, so the last one is the level now. UPower records the level only when it changes, so the chart is never finer than that anyway.
  • Each column is a slot of its own in the track the agents panel's meters use (Style.selectedFillFor), with the theme's corners (Style.cornerRadius, capped at half a column): square cells with Hyprland rounding at 0, pills above it. The thin bar shown without history keeps its pill shape.
  • It reads the history from UPower with one GetHistory call when the panel opens, and again when the level or state changes while it is open. No timer, and nothing runs while the panel is closed.
  • UPower writes a reading only when the level changes, so each one holds until the next: the line opens at the level in force when the window starts, and runs on to now at the live level. A flat line means the level didn't move (on AC at a charge limit, say), not missing data.
  • The row UPower writes when it starts up (state 0, 0%) marks a restart rather than an empty battery, and is skipped.
  • Hovering a column reads it: that column stays full while the rest step back, and a tooltip above it gives its level and how long ago it was, like 62% · 2h 10m ago (now on the last column). It follows the agents panel's usage meters, which show their numbers in a PanelToolTip on hover, with delay: 0 like the Elsewhen daylight chip, since it's a readout rather than help text. Nothing on it animates, since it follows the pointer. The chart isn't part of the keyboard cursor, which only moves between power profiles, and the hero already shows the level now.
  • Time runs with the reading direction, so it flows right to left in Arabic, Hebrew, Persian and Urdu.
  • With more than one battery (UPower keeps history per pack, and the display device has none), or no history, the panel shows the plain bar as before.
  • The chart's room is kept from the first open, so the panel doesn't grow when UPower's reply lands.

The manual's Power entry and the bar README's widget list mention the charge history, and the manual says the chart can be hovered. Four English strings are added for the tooltip.

Overlap. None of the open PRs touching the power panel changes this spot or reads UPower's history. #10377 re-indents the whole panel inside a ScrollView, so whichever lands second needs a mechanical rebase.

Testing

  • test/shell.d/power-test.sh: the battery's UPower path, restart rows skipped, readings held until the next, the opening level before the window, a window without readings, the live level at the end, the hover readout (the level before and after a step, now at the end, nothing before the first reading), and the columns (each at the level its stretch ends on, none before the first reading).
  • i18n, motion, power-no-battery, power-present, qml-text-format, panel-open-budgets (power panel: first open 63ms, reopen 54ms) and shell-idle-spawn pass.
  • Checked in a running session on an ASUS laptop with its real history (held at a 75–80% charge limit) and a simulated discharge, on dark and light themes (Tokyo Night, Gruvbox, Catppuccin Latte, and a pass over twelve more for the hover contrast), with Hyprland rounding at 0 and at 8, and with the history turned off to see the plain bar. The hover was checked by moving the pointer across the chart in both a dark and a light theme.
  • Not checked: a right-to-left language, or a machine with two batteries.

Captures

Hovering the chart on Tokyo Night, Catppuccin Latte and Gruvbox. The history here is simulated, a drain from 85% to 40% and a charge back to 96%, since the real one on this laptop sits flat at its charge limit:

omarchy-power-chart-demo-panel.mp4

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The power panel adds a six-hour charge chart with hover readouts and a plain-bar fallback.

  • The power panel shows six hours of battery charge changes.

Reviews (9) · Last reviewed commit: "Keep low charge columns at their level w..." · Reviewed by Greptile

Comment thread shell/plugins/panels/power/Panel.qml Resolved
…r it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yamz8 yamz8 changed the title Show the last six hours of battery charge in the power panel Grow the power panel's charge bar into a chart of the last six hours Nov 2, 2026
Hovering the power panel's chart draws a hairline and a dot at the
pointer and a tooltip above it with the level there and how long ago
it was, like "62% · 2h 10m ago".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread shell/plugins/panels/power/Model.js Resolved
yamz8 and others added 5 commits November 3, 2026 00:46
The chart was laid out once per read, so a panel left open with nothing
changing kept a window, and hover times, from when the history was
fetched. It now lays the readings out again as the pointer enters the
chart. A read queued behind a running one is also dropped when the
panel closes instead of starting after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The queued rerun is deferred, so checking before it was scheduled still
let one start if the panel closed in between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The faint fill under a thin line read as one grey slab, especially on
light themes. The chart is now a single area in the bar's fill colour
over the same track, 24px tall instead of 32px. Hovering marks the
level with a dot on the area's edge and a cut through the area under it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chart had a fixed 6px radius, so it stayed rounded beside square
buttons on a theme with no rounding. It now takes Style.cornerRadius
like the panel's buttons, and its track uses the selected fill the
agents panel's meters use instead of a fixed alpha. The thin bar shown
without history keeps its pill shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The solid area was heavy on light themes and its slopes looked rough at
this size. The chart is now 36 columns over the six hours, each its own
slot in the meter track with the theme's corners, filled to the level at
the end of its ten minutes, so the last one is the level now. UPower
records the level only when it changes, so the chart was never finer.

Hovering a column keeps it full while the rest step back, and the
tooltip reads that column. The clipping layer and the shape code are
gone with the area.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread shell/plugins/panels/power/Panel.qml Resolved
Each column's fill stood at least two corner radii tall, about a third
of the chart with Hyprland rounding on, so every level below that drew
the same. The height follows the level again and a short fill takes a
smaller radius instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the enhancement New feature or request label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants