Skip to content

controlCenter: notify rebuilt widgets of visibility when CC is open - #774

Open
AquilaAscension wants to merge 1 commit into
ErikReider:mainfrom
AquilaAscension:fix-reload-widget-visibility
Open

AquilaAscension wants to merge 1 commit into
ErikReider:mainfrom
AquilaAscension:fix-reload-widget-visibility

Conversation

@AquilaAscension

Copy link
Copy Markdown

Problem

When the config is reloaded (swaync-client -R / DBus ReloadConfig) while the control center is open, add_widgets() tears down and recreates every widget, but the new widgets never receive on_cc_visibility_change(true) — that event only fires in set_visibility().

Consequences while the panel stays open:

  • volume and backlight sliders drop to 0 — their backend clients (PulseDaemon, BacklightUtil) are only started by the visibility event, so the sliders keep GTK's default value
  • buttons-grid toggle buttons show stale/default state — their update-command is only run from on_cc_visibility_change

Reproduce

  1. Configure a volume or backlight widget and open the control center
  2. Run swaync-client -R
  3. Both sliders read 0 and toggles lose their state until the panel is closed and reopened

Fix

After rebuilding the widget list in add_widgets(), fire the visibility event if the control center is currently visible, mirroring what set_visibility() does. Widgets rebuilt while hidden are unaffected (they still get the event on the next open).

Tested on 0.12.6 with volume, backlight, and buttons-grid toggle widgets: after this change, an in-place ReloadConfig keeps slider values correct and re-syncs toggle states, with no need to close/reopen the panel.

🤖 Generated with Claude Code

When the config is reloaded while the control center is visible,
add_widgets() tears down and recreates every widget, but the new
widgets never receive on_cc_visibility_change(true). As a result:

- the volume and backlight sliders stay at 0 (their backend clients
  are only started by the visibility event)
- buttons-grid toggle buttons never run their update-command, so they
  show their default state instead of the real one

Reproduce on stock swaync: open the control center with a volume or
backlight widget configured, then run 'swaync-client -R'. Both sliders
drop to 0 until the panel is closed and reopened.

Fix: after rebuilding the widget list, fire the visibility event when
the control center is currently visible, mirroring set_visibility().

Co-Authored-By: Claude Fable 5 <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