Skip to content

fix(battery): apply panel settings from the widget that opened it#2517

Open
cyril-marpaud wants to merge 1 commit intonoctalia-dev:mainfrom
cyril-marpaud:fix/battery-panel-settings-override
Open

fix(battery): apply panel settings from the widget that opened it#2517
cyril-marpaud wants to merge 1 commit intonoctalia-dev:mainfrom
cyril-marpaud:fix/battery-panel-settings-override

Conversation

@cyril-marpaud
Copy link
Copy Markdown

Problem

When two Battery widgets are configured simultaneously (e.g. one for the laptop battery, one for a Bluetooth headset), the Show power profile controls and Show Noctalia Performance toggle settings from the second widget were being ignored — the first widget's settings always won.

Root cause

getBatteryPanel() was writing panelID (which controls showPowerProfiles and showNoctaliaPerformance in the panel) as a side effect on every call. This function was also called from a reactive QML tooltipText binding on each widget instance:

tooltipText: !getBatteryPanel()?.isPanelOpen ? root.tooltipContent : ""

Because this binding depends on isPanelOpen, it re-evaluates on every panel open/close. With two widget instances, both bindings fire and the last one to run overwrites panelID — consistently producing the first widget's settings.

Fix

  • getBatteryPanel() now only returns the panel, with no side effects
  • panelID is written in toggleBatteryPanel(), guarded by !panel.isPanelOpen so it only fires when actually opening the panel — not when closing it

This ensures the panel always reflects the settings of the widget that opened it, for its entire open → close lifecycle.

Testing

Reproduced with two Battery widgets (laptop + Bluetooth headset) with different showPowerProfiles / showNoctaliaPerformance values. Confirmed fix resolves the issue.

When two Battery widgets were configured simultaneously, the panelID
(which controls showPowerProfiles and showNoctaliaPerformance in the
panel) was being overwritten by reactive QML bindings on both widget
instances whenever isPanelOpen changed. This caused one widget's
settings to consistently override the other's.

Move the panelID write out of getBatteryPanel() (which was called from
a reactive tooltipText binding) and into toggleBatteryPanel(), guarded
by !panel.isPanelOpen so it only fires when actually opening the panel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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