Skip to content

battery: redesign the bar widget and popout - #4337

Draft
Conava wants to merge 5 commits into
duxlabs-dev:masterfrom
Conava:battery-widget-redesign
Draft

Conava wants to merge 5 commits into
duxlabs-dev:masterfrom
Conava:battery-widget-redesign

Conversation

@Conava

@Conava Conava commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Dependency

duxlabs-dev/dux-qml-common#57 needs to be merged and qml-common bumped before this gets merged.

Description

Redesigns the battery bar widget and its popout, following the design discussion in the discord. I wanted the battery of my mouse and headset next to the laptop battery in the bar, and a popout that can be arranged like the rest of the shell.

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 Theme, Low and charging or Level.

Popout:

  • The battery level is shown as a Line, Ring or Card, wavy while charging. Line and Card have a Shape or Ring badge.
  • Overview, Power profile and Devices are sections that can be switched off, and their spacing follows Interface density. The details have four layouts, the devices five and the power profile four styles. The power profile can also sit inside the overview card.
  • When the Overview section is off, or 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; a pen in the popout opens them, and the gear opens the Battery settings page.

Behavior changes:

  • Theme as bar color is now the plain widget color like other widgets. Existing Theme settings become Low and charging, which is the closest to what it did (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 popout looks different by default. Everything it showed before is still there.
  • 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: peripherals get the low look in the bar and popout, notifications are separate work.

Screenshots / video

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

The bar widget can now show peripheral batteries (mouse, headset, ...)
next to the system battery, as an ordered list of entries with icon,
percentage and an "only when low" option. Battery style is Icon, Solid
or Circle, each horizontal or vertical, and entries are separated by a
gap, line, dot or their own pill. Color is the plain widget color, Low
and charging, or Level.

The popout is rebuilt from sections: an overview of the battery (Line,
Ring or Card, wavy while charging), the power profile (Circle,
Segments, Buttons or Slider) and the devices, each with its own layout
and switch. Spacing follows the interface density. When there is no
battery the lowest device takes the overview. All looks live in the
battery widget options; the popout links to them and to the Battery
settings page. The Control Center reuses the popout content and keeps
a Battery tile on desktops with peripherals.

Config version 47 maps the old values: Theme color becomes Low and
charging, Outline becomes Solid, Ring and Duo become Circle with the
direction taken from the bar position.
@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
The button group, detail chip and wavy ring and line now come from the
shared widgets, which gained the parts the battery needed (width shares
for the selected button, a chip icon slot, a charge limit with the part
past it dimmed or hatched). The battery copies of them are gone.

The popout defaults to a compact look: the level with the charging
target beside it, the bar hatched past the charge limit, power profile
and details grouped under one Battery label, and devices as filled bars
that fade out and collapse when one disconnects. The Devices section
shows once a peripheral has connected during the open popout. The
previous card look stays reachable as the Line style. The Slider power
style is redesigned with a sliding thumb and the profile as a chip.

Fixes from review: compact device tiles no longer overflow with an odd
count, a device hero no longer shows a clock icon, the ring layout's
buttons no longer cover the first fact, a vertical Solid meter fits a
horizontal bar, separated pills blur up to their rounded outer ends, the
past-limit shade uses the theme scrim, and the Control Center no longer
rebuilds its widget list on every peripheral update.

While charging toward a charge limit the time remaining counts to the
limit, everywhere it is shown. The bar and popout share one device icon
and badge rule, every battery meter host passes its color mode, and the
island offers the same color options as the bar. Power profile icons
match between the popout and the Control Center tile.
Low and charging colors the laptop battery with the theme accent while
it is plugged in but not charging, like the theme mode did before it
was folded into Low and charging. The Control Center battery detail
stops its wave and releases the battery data when the Control Center
closes. The power saver icon stays outlined wherever a selected profile
icon is filled.

Housekeeping: the hero layouts share one column with their footer, the
popout sizes live in the metrics file, the meter names its proportions,
the bar color options come from one list, and a dead color property, a
refactor-only test and a few comments are gone. Long button labels
elide in the power profile buttons.
@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.

The group's height read stats.visible, which is false while the group
itself is hidden, so once the details list started empty (before the
first battery reading, or with no power profile in the list) the group
never came back. It now reads the entry count instead.

The bars device list uses DListView like the other lists, with its own
row fade off so it doesn't double up with the add and remove
transitions.
@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

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

feature ui Quickshell UI under quickshell/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants