Skip to content

[Repo Assist] fix: use actual brightness/colour-temp values when Settings window closes #142

Closed as not planned

Description

@github-actions

🤖 This pull request was created by Repo Assist, an automated AI assistant.

Problem

SettingsWindow_Closing was persisting BrightnessSlider.Value and ColorTempSlider.Value rather than the main window's actual current values.

Two scenarios were broken:

  1. Hotkey/toolbar changes while Settings is open — user adjusts brightness or temperature via Ctrl+Shift+↑/↓ or the control toolbar. The sliders don't react to external changes, so they become stale. On close, the stale slider values were written back, silently discarding the user's adjustments.

  2. Slider track clicks — WPF moves the thumb via keyboard-style commands when the user clicks the track; Thumb.DragCompleted does not fire, so BrightnessSlider_DragCompleted (which saves with save:true) was never reached. The Closing handler was the only save path for track clicks.

Root Cause

// Old code — used stale slider display value
mainWindow.SetBrightness(BrightnessSlider.Value, save: true);
mainWindow.SetColorTemperature(ColorTempSlider.Value, save: true);

Fix

Call SetBrightness/SetColorTemperature with mainWindow.GetBrightness() / mainWindow.GetColorTemperature() so the final persisted value always reflects the true application state.

// New code — uses the authoritative application state
mainWindow.SetBrightness(mainWindow.GetBrightness(), save: true);
mainWindow.SetColorTemperature(mainWindow.GetColorTemperature(), save: true);

Changes

  • WindowsEdgeLight/SettingsWindow.xaml.cs — 7 lines added, 2 changed

Test Status

Step Result
dotnet build /p:EnableWindowsTargeting=true ✅ 0 errors, 0 warnings

Closes #137

Note

🔒 Integrity filter blocked 1 item

The following item 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 · ● 1.8M · ◷

To install this agentic workflow, run

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

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/fix-settings-stale-slider-2026-07-14-548e4c9423207c97-31f774ed1ee95aa0.

Click here to create the pull request

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (62 of 62 lines)
From 517fcbf3808138ca7ec7e48acc332a935e543bba Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
 <41898282+github-actions[bot]@users.noreply.github.com>
Date: Tue, 14 Jul 2026 13:23:58 +0000
Subject: [PATCH] fix: use actual brightness/colour-temp values when Settings
 window closes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

SettingsWindow_Closing was persisting BrightnessSlider.Value and
ColorTempSlider.Value rather than the mainWindow's current actual values.

Two scenarios break with the old code:
1. User changes brightness/temperature via hotkeys (Ctrl+Shift+↑/↓) or
   the control toolbar while the Settings window is open.  The sliders
   do not react to external changes, so their values become stale.  On
   close, the stale slider values were written back, silently discarding
   the user's hotkey/toolbar adjustments.

2. Slider track clicks: in WPF, clicking on the Slider track moves the
   thumb via keyboard-style commands; Thumb.DragCompleted does not fire
   for this interaction, so BrightnessSlider_DragCompleted (which saves
   with save:true) was never reached for track clicks.  The Closing
   handler was the only safety net for this path.

Fix: call SetBrightness/SetColorTemperature with mainWindow.GetBrightness()
/ GetColorTemperature() so the final persisted value always reflects the
true application state, not the slider's display state.  This correctly
handles both the stale-slider scenario and the track-click scenario.

Build: 0 errors, 0 warnings (net10.0-windows, EnableWindowsTargeting=true)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 WindowsEdgeLight/SettingsWindow.xaml.cs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/WindowsEdgeLight/SettingsWindow.xaml.cs b/WindowsEdgeLight/SettingsWindow.xaml.cs
index 03e4ca2..4f705a7 100644
--- a/WindowsEdgeLight/SettingsWindow.xaml.cs
+++ b/WindowsEdgeLight/SettingsWindow.xaml.cs
@@ -83,8 +83,13 @@ 
... (truncated)

Activity

  1. shanselman commented on Aug 8, 2026

    @shanselman
    Owner

    Duplicate of #137.

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