Skip to content

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

Closed as not planned

Description

@github-actions

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

Bug

SettingsWindow_Closing was saving BrightnessSlider.Value and ColorTempSlider.Value directly to the application state. The sliders do not react to changes made outside the Settings window. If the user adjusted brightness or colour temperature via:

  • Keyboard shortcuts (Ctrl+Shift+↑ / Ctrl+Shift+↓)
  • Toolbar buttons while Settings was open

...the slider display stayed at its old position. When the user then closed Settings, the stale slider values were persisted, silently overwriting the external changes.

Reproduction:

  1. Open Settings. Note Brightness = 80%.
  2. Press Ctrl+Shift+↓ twice. Brightness drops to 50%. Slider still shows 80%.
  3. Close Settings.
  4. Settings saves 80% — the hotkey changes are lost.

Fix

Use mainWindow.GetBrightness() / mainWindow.GetColorTemperature() in the Closing handler instead of the slider display values. These always return the actual current application state.

// Before
mainWindow.SetBrightness(BrightnessSlider.Value, save: true);
mainWindow.SetColorTemperature(ColorTempSlider.Value, save: true);

// After
mainWindow.SetBrightness(mainWindow.GetBrightness(), save: true);
mainWindow.SetColorTemperature(mainWindow.GetColorTemperature(), save: true);

This also correctly handles track clicks on sliders (clicking the track moves the thumb via keyboard commands — Thumb.DragCompleted is not fired, so DragCompleted handlers never ran for track interactions). With this fix, the Closing handler always saves the true in-memory value regardless of how it was changed.

Trade-offs

  • Minimal: 2 lines changed in one method.
  • No new dependencies.

Test Status

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

Manual testing required: open Settings, use Ctrl+Shift+↑ while window is open, verify change is preserved on close.

Note

🔒 Integrity filter blocked 3 items

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

  • #144 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • Detect camera is being used by another application and automatically turn on #21 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #21 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

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

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

Generated by Repo Assist · ● 3.3M · ◷

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-08-03-1c9540cd7daaadd8.

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 (48 of 48 lines)
From c4633b382b1faf3897bcd6f0573da392238ebc16 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Mon, 3 Aug 2026 13:45:56 +0000
Subject: [PATCH] fix: save 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 saving BrightnessSlider.Value and
ColorTempSlider.Value. The sliders do not react to external changes
(hotkeys Ctrl+Shift+↑/↓ or toolbar buttons), so their values become
stale if the user adjusted brightness or temperature while the window
was open. Closing Settings then overwrote those changes.

Fix: call SetBrightness/SetColorTemperature with the mainWindow's actual
current values (GetBrightness / GetColorTemperature) so the final
persisted value always reflects the true application state.

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

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

diff --git a/WindowsEdgeLight/SettingsWindow.xaml.cs b/WindowsEdgeLight/SettingsWindow.xaml.cs
index 03e4ca2..4edb339 100644
--- a/WindowsEdgeLight/SettingsWindow.xaml.cs
+++ b/WindowsEdgeLight/SettingsWindow.xaml.cs
@@ -83,8 +83,11 @@ public partial class SettingsWindow : Window
 
     private void SettingsWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
     {
-        mainWindow.SetBrightness(BrightnessSlider.Value, save: true);
-        mainWindow.SetColorTemperature(ColorTempSlider.Value, save: true);
+        // Use the mainWindow's actual current values rather than the slider display values.
+        // Sliders do not react to external changes (hotkeys, toolbar), so their values can be
+        // stale if the user adjusted brightness/temperature while this window was open.
+        mainWindow.SetBrightness(mainWin
... (truncated)

Activity

  1. shanselman commented on Aug 8, 2026

    @shanselman
    Owner

    Duplicate of #137; the consolidated maintainer batch covers the stale-value data-loss fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions