Skip to content

Apply battery threshold colors to power rate - #612

Open
krosct wants to merge 2 commits into
corecoding:mainfrom
krosct:main
Open

krosct wants to merge 2 commits into
corecoding:mainfrom
krosct:main

Conversation

@krosct

@krosct krosct commented Oct 20, 2026

Copy link
Copy Markdown

Problem

Battery threshold colors (battery-colors) only apply to Percentage. The Power Rate sensor (format watt), which is also the battery value shown in the top bar, never gets a color, because helpers/catalog.js lists only 'percent' in the battery colorFormats.

So:

  • an "All sensors" color scale on the Battery page does not color Power Rate;
  • if Power Rate is pinned to the panel, it is offered in the "Add Color Scale" dropdown and a scale can be saved for it, but that scale is never applied;
  • if it is not pinned, it is not offered in the dropdown at all.

Changes

  • helpers/catalog.js: add 'watt' to the battery colorFormats. Power Rate, including the battery value in the panel, now uses battery-colors: both the "All sensors" scale and a per-sensor scale are applied, and Power Rate is listed in "Add Color Scale" whether or not it is pinned.
  • schemas/org.gnome.shell.extensions.vitals.gschema.xml: the battery-colors description now mentions power rate (watts). The key's type and default are unchanged, so existing settings keep working (scales already saved for Power Rate start to apply).

Notes

  • Power Rate is matched in watts, with a sign: positive while charging, negative while discharging. Thresholds use the existing value >= threshold rule, so negative breakpoints can color discharge rates.
  • Validated with glib-compile-schemas --strict --dry-run schemas/.
  • Tested on GNOME Shell 50.1 (Wayland): Power Rate is colored by both an "All sensors" scale and a per-sensor scale.

krosct and others added 2 commits October 20, 2026 11:02
Add 'watt' to the battery colorFormats so Power Rate (and the battery
value shown in the panel) uses battery-colors, like Percentage already
does. Per-sensor scales for Power Rate become available in prefs, and
the "All sensors" scale now covers it too.

Update the battery-colors schema description accordingly.
Apply battery threshold colors to power rate

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant