Skip to content

battery: redesign the bar widget and popout - #4337

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
Conava:battery-widget-redesign
Nov 30, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
Conava:battery-widget-redesign

Conversation

@Conava

@Conava Conava commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Needs duxlabs-dev/dux-qml-common#57 for the shared widget changes. Has already been merged now so this PR is good to go!

Redesigns the battery bar widget and the popout.

Bar widget:

  • Battery style is Icon, Solid or Circle, each horizontal or vertical.
  • The widget can show the system battery and the batteries of connected peripherals in any order, each with an icon and a percentage, optionally only when low. Peripherals are not shown by default.
  • Separator between entries: Gap, Line, Dot or Separate (each entry gets its own background).
  • Color is Primary, Theme, Low and charging or Level, the same choices as for the island and the popout.

Popout:

  • The battery level is shown as a Line, Ring or Card, wavy while charging.
  • A Compact switch gives the popout a more compact look, and both looks scale a with the shell's Interface density too.
  • Each of the sections overview, power profile and statistics can be switched off. The statistics have four layouts, the devices five and the power profile four styles.
  • When there is no battery, the connected device with the lowest charge takes its place at the top.
  • The popout's look is set in the battery widget's options. The widget gets a pen icon to open it, and the gear opens the Battery settings page.

Behavior changes:

  • The Theme option for the bar color now uses the normal widget color, the same as other bar widgets. Bars that had Theme selected are migrated to Low and charging, which comes closest to how Theme looked before (charging is now green instead of primary).
  • Saved Outline, Ring and Duo battery styles become Solid or Circle, keeping the direction they had in the bar.
  • The bar widget now uses the Solid style by default instead of Icon.
  • On a desktop with battery devices, the Control Center tile is now a Battery tile that opens the detail instead of switching the power profile on click. The power profile can be changed in the detail.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Partially implements #3806, excluding the notification part of this issue.

Screenshots / video

screenshot_2026-11-28_18-14-32

Use case for a desktop PC without a battery:
screenshot_2026-11-28_18-42-15

Popout

(Color update on the device row that is not on the other screenshots. depending on the theme they looked very weird. now its the charge status merged with the background row)
screenshot_2026-11-28_19-20-37

screenshot_2026-11-28_17-21-16 screenshot_2026-11-28_17-21-56
More styles and layouts screenshot_2026-11-28_17-22-36 screenshot_2026-11-28_15-43-28 screenshot_2026-11-28_15-44-28 screenshot_2026-11-28_15-41-24 screenshot_2026-11-28_15-41-40
Settings screenshot_2026-11-28_18-05-14 screenshot_2026-11-28_18-05-29

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean
  • QML changes: ran make lint-qml with no new warnings
  • I have opened a corresponding pull request in dux-docs to document any new behaviors: docs: add battery widget page dux-docs#214

@github-actions github-actions Bot added breaking feature ui Quickshell UI under quickshell/ labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

Four layout and rendering bugs, plus some reuse, token and idle-cost cleanups.

  • Compact device grid overflows with 5, 7, 9… devices because the widened last tile makes column 0 two cells wide, quickshell/Modules/DBar/Popouts/BatteryDeviceList.qml:245
  • Device hero shows a clock icon next to "Charging" / "Low Battery", quickshell/Modules/DBar/Popouts/BatteryPopoutContent.qml:135
  • Ring + list layout: the edit and settings buttons draw over the first fact row, quickshell/Modules/DBar/Popouts/BatteryHero.qml:615
  • Vertical solid meter in a horizontal bar is not clamped and overflows the pill (new default direction), quickshell/Modules/DBar/Widgets/Battery.qml:38
  • Per-segment blur uses the inner radius at the rounded outer ends, so blur leaks past the corners, quickshell/Modules/SurfaceWidgets/BarPill.qml:267
  • Hardcoded black for the past-limit shade, use Theme.scrimColor, quickshell/Modules/DBar/Popouts/BatteryHero.qml:60
  • BatteryChip nearly duplicates DDetailChip and hardcodes its border alpha, quickshell/Modules/DBar/Popouts/BatteryChip.qml:13
  • Segments and buttons power profile styles re-implement DButtonGroup, quickshell/Modules/DBar/Popouts/BatteryPowerProfile.qml:129
  • BatteryLevelRing and BatteryLevelBar overlap DCircularWavyProgress and M3WaveProgress, quickshell/Widgets/BatteryLevelRing.qml:6
  • Control Center widget definitions rebuild on every peripheral battery update, quickshell/Modules/ControlCenter/Models/WidgetModel.qml:410

Docs pending: new battery widget options (batteryDirection, batterySeparator, batteryDevices, Level and Low and charging color modes) and the batteryPopout* settings. No dux-docs PR is linked.

Checked: the v47 settings migration and its idempotence, JS helper/QML contracts, settings keys, untouched translation catalogs, the generated search index, wave timer gating, other BarPill and BatteryMeter callers, the Control Center tile, the settings sidebar, deprecated shims, D* widgets and I18n. Model: claude-opus-5-5.

Comment thread quickshell/Widgets/BatteryLevelRing.qml Resolved
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

The ten findings from the last review are fixed. Two new issues: a popout bug and a raw ListView.

  • The stats group can hide for good: its height reads stats.visible, which stays false while the group itself is hidden, quickshell/Modules/DBar/Popouts/BatteryPopoutContent.qml:344
  • Raw ListView in the bars device layout, use DListView, quickshell/Modules/DBar/Popouts/BatteryDeviceList.qml:513

Docs pending: new battery widget options (batteryDirection, batterySeparator, batteryDevices, the Level and Low and charging color modes) and the batteryPopout* settings. No dux-docs PR is linked.

Checked: the earlier findings against HEAD, the v47 migration and its idempotence, settings keys in the spec, data, profiles and UI, the JS helper and QML contracts, other BarPill and BatteryMeter callers, per-corner segment blur, the Control Center tile and model, DButtonGroup use, idle wave and timer gating, deprecated shims, D* widgets, I18n, and untouched catalogs and search index. Model: claude-opus-5-5.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

No issues found. Both findings from the last review are fixed: the details group now reads stats.count, and the bars device list uses DListView with its row fade off.

Checked: the hero layouts moved into one column with their footer (invisible footers add no gap), FillFace taking the shared face object, the new pluggedIn argument in every colorFor caller, Theme.powerProfileIconFilled in the modal, choices and slider thumb, the Control Center detail going inactive when its window hides, the metrics moved into BatteryPopoutMetrics, BATTERY_BAR_COLORS in both option pages, device badge colors after the overrides were dropped, the removed levelColor (no callers left), and the DListView properties. The dux-docs PR is linked. Model: claude-opus-5-5.

@purian23 purian23 removed the breaking label Nov 27, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

One layout bug: the ring hero can show a blank column when a peripheral leads.

  • Ring + List details with a peripheral hero that is neither charging nor low: the ring sits at the leading edge beside an empty facts column, quickshell/Modules/DBar/Popouts/BatteryPopoutContent.qml:96

Checked:

  • The trim and review-fix commits: no removed setting, helper or property is still referenced.
  • The v50 migration: style folds, direction, theme to lowcharging, and bars and docks.
  • colorFor and the primary/accent modes across the bar, island, Control Center and dash.
  • The temperature D-Bus subscription lifecycle and the charge-limit time estimate.
  • Every SettingsReorderRow, SettingsMetricList and BatteryMeter caller.
  • openBarWidgetSettings for docks, idle wave and timer gating, and the used props of the bumped DCommon widgets.
  • Deprecated shims, D* widgets, I18n, and the untouched catalogs.

Model: claude-opus-5-5.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The finding from the last review is fixed: factsBeside now requires showBattery, so a peripheral hero uses the full ring, which still shows its state through timeLine.

Checked:

  • The Compact switch replacing batteryPopoutDensity: no references left in the spec, data, profiles, migrations or search index, and the densityLevel to shellOffset mapping.
  • Removed metrics (labelTop, dense, spaciousStep) and the dropped Devices heading: no callers left.
  • openBarWidgetSettings with an origin: the registration context fields (occurrenceId, occurrenceOrder, section, surface), the normalized bar model index matching the config index, the dock and island fallbacks, and a null origin.
  • The scissor-clipped fills in BatteryMeter and the card hero, including the vertical offset and the clipped fill text.
  • The circle shape for the balanced power profile.

Model: claude-opus-5-5.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

No issues found in the four commits since the last review (f3fac77..HEAD).

Checked:

  • Overview switch: popoutHasHero now needs batteryPopoutBattery, and heroDevice only leads without a battery. Checked every popoutHasHero and batteryPopoutBattery reader, the Settings and Edit footer shown when there is no hero, and the Overview card and Show toggle visibility on desktops.
  • The power profile heading replacing SectionLabel: non-slider heading styling and the corner radii without a hero.
  • Compact BatteryPopoutMetrics cuts: the regular sizes stay the same, DeviceGlyph and LevelRing take the new size, and labelFont matches the StyledText default.
  • Neutral surfaceContainerHighest tracks against the DCard and bar backgrounds.
  • SettingsReorderRow: checkable and checked with a toggle action on clicked(true).
  • openBarWidgetSettings falling back to docks when no bar holds the widget, with no barId and with a null origin.
  • The upstream merge: no PR file was touched. The dux-qml-common pin still points at the dux-qml-common#57 branch and needs repinning, as the description says.

Model: claude-opus-5-5.

@Conava
Conava marked this pull request as ready for review November 28, 2026 18:48
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

No issues found in the two commits since the last review (095cd1d..HEAD).

Checked:

  • The reserved width in the bar widget: NumericText keeps max(implicitWidth, reserve), so time and power text still fit. The system reserve swaps only the leading percentage for "100%", there is no reserve in vertical bars, and every device reserves "100%", including the "–" of an unknown one.
  • BatteryMeter fitting its body and ring text to "100" for every caller, and sidePercentShown replacing the two copies of the same condition.
  • The dux-qml-common bump replacing the dux-qml-common#57 branch pin. Whether the new commit is on master could not be checked from here.

Model: claude-opus-5-5.

@bbedward
bbedward force-pushed the battery-widget-redesign branch from 4a222b0 to 7df38eb Compare November 30, 2026 15:44
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

Two bugs in the squashed branch: a crash and a gap in the migration.

  • The Control Center battery menu's "Widget settings" row throws in openBarWidgetSettings when the widget sits on a bar, so settings never opens, quickshell/Services/PopoutService.qml:646
  • The v50 battery migration skips island layouts, so island batteries keep ring/duo styles and the icon style turns sideways, quickshell/Common/settings/SettingsStore.js:129

Checked:

  • The full squashed diff against origin/master, split into three areas: popouts, bar widget and settings UI, and settings, services and tests.
  • The v50 migration: version number, idempotence, bars and docks.
  • New batteryPopout* keys across the spec, data and profiles.
  • The temperature D-Bus lifecycle in BatteryService.
  • Every openBarWidgetSettings, colorFor, BatteryMeter, SettingsReorderRow and SettingsMetricList caller.
  • Theme, D* widget and service properties used by the new code.
  • Idle timers and wave gating.
  • Deprecated shims, raw views and I18n.
  • The catalogs are untouched, and the dux-qml-common pin is on its master.

Model: claude-opus-5-5.

Comment thread quickshell/Services/PopoutService.qml Outdated
openSettingsWithTab("bar_widget");
return;
}
const slotted = origin?.barId === barId && !origin.surface?.islandController;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws when openBarWidgetSettings is called without barId and origin, which is what the new "Widget settings" row in the Control Center battery menu does (WidgetConfigOverlay.qml:213). origin?.barId === barId is undefined === undefined, so it is true, and origin.surface then reads a property of undefined.

It breaks whenever the battery widget is on a bar, or in no bar or dock. Only the dock path returns before this line. Settings never opens, and the root.close() after the call never runs, so the menu stays open.

Suggested change
const slotted = origin?.barId === barId && !origin.surface?.islandController;
const slotted = !!origin && origin.barId === barId && !origin.surface?.islandController;

if (bar.batteryColorMode === "theme")
bar.batteryColorMode = "lowcharging";
for (var k = 0; k < BAR_WIDGET_LIST_KEYS.length; k++)
migrateBatteryWidgetList(bar[BAR_WIDGET_LIST_KEYS[k]], ["id", "widgetId"], isVerticalPosition(bar.position));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v50 migration skips battery widgets in island layouts. Island bars render any bar widget from bar.islandHomeLayout through SurfaceWidgetHost (HomeCompact.qml:1076), and an island widget inside a bar list carries its own islandHomeLayout. eachSysmonList (line 935) already walks both, but this loop only covers BAR_WIDGET_LIST_KEYS.

After upgrading, an island battery with batteryStyle: "ring" or "duo" stays unmigrated. Battery.qml:298 only maps "circle" to the arc, so it draws as a solid meter. The style dropdown has no matching value either. An island "icon" entry doesn't get batteryDirection: "vertical", so it falls back to the "horizontal" default and is rotated 90°.

Fix: also call migrateBatteryWidgetList on bar.islandHomeLayout and on the islandHomeLayout of each island widget in the bar lists, with the bar's vertical.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude review

No issues found. Both findings from the last review are fixed in 4d7d5c8.

Checked:

  • openBarWidgetSettings with no origin: slotted is false, the list is empty, list[undefined] gives no exact entry, and it falls back to locateBarWidget. The dock path is unchanged.
  • The v50 migration now covers bar.islandHomeLayout and the islandHomeLayout of each island widget in the bar lists. It walks the same lists as eachSysmonList, uses the bar's vertical (the island follows the bar's orientation), and running it twice changes nothing.

Model: claude-opus-5-5.

@bbedward
bbedward merged commit 2b9a36f into duxlabs-dev:master Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature ui Quickshell UI under quickshell/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants