Skip to content

[Repo Assist] fix: keep Settings sliders in sync when brightness/colour-temp changed externally #145

Closed as not planned

Description

@github-actions

🤖 This issue was created by Repo Assist, an automated AI assistant, because GitHub Actions cannot create pull requests in this repository.

Problem

When the Settings window is open, changing brightness or colour temperature via hotkeys (Ctrl+Shift+↑/↓) or the toolbar buttons does not update the sliders in the Settings window. The sliders show stale values until the window is closed, causing user confusion.

This is a deeper version of the bug tracked in issue #137. That issue only fixes the save-on-close problem (reading actual values instead of stale slider values). This fix keeps the sliders live throughout the Settings session.

Root Cause

SetBrightness and SetColorTemperature in MainWindow have no notification mechanism. SettingsWindow reads the values only once at construction and never again until close.

Fix

Branch: repo-assist/fix-settings-live-sync-2026-07-26
Compare: https://github.com/shanselman/WindowsEdgeLight/compare/master...repo-assist/fix-settings-live-sync-2026-07-26?expand=1

Changes

MainWindow.xaml.cs — add two events:

public event EventHandler<double>? BrightnessChanged;
public event EventHandler<double>? ColorTemperatureChanged;

Fire them at the end of SetBrightness and SetColorTemperature.

SettingsWindow.xaml.cs — subscribe on open, unsubscribe on close, guard against re-entrancy:

private bool _updatingFromExternal = false;

// In constructor (after isInitializing = false):
mainWindow.BrightnessChanged += OnBrightnessChanged;
mainWindow.ColorTemperatureChanged += OnColorTemperatureChanged;

private void OnBrightnessChanged(object? sender, double value)
{
    _updatingFromExternal = true;
    BrightnessSlider.Value = value;
    UpdateBrightnessLabel();
    _updatingFromExternal = false;
}

// ValueChanged handlers now also check _updatingFromExternal

Why _updatingFromExternal?

Setting BrightnessSlider.Value fires ValueChanged, which calls SetBrightness, which fires BrightnessChanged again — infinite loop. The flag breaks the cycle.

Test Status

✅ Build passed on Linux with -p:EnableWindowsTargeting=true — 0 warnings, 0 errors.

Manual testing required: open Settings, use Ctrl+Shift+↑ while window is open, verify slider moves in real time.

Supersedes

This fix makes issue #137 (read actual values on close) unnecessary, since the sliders are always in sync.


To apply: Settings → Actions → General → ✅ Allow GitHub Actions to create and approve pull requests

Note

🔒 Integrity filter blocked 2 items

The following items were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist · ● 2.1M · ◷

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Activity

  1. shanselman commented on Aug 8, 2026

    @shanselman
    Owner

    The consolidated batch fixes stale-value data loss; live slider observer plumbing is not worth the added coupling.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions