diff --git a/WindowsEdgeLight/AppSettings.cs b/WindowsEdgeLight/AppSettings.cs
index bf12831..9eeaf22 100644
--- a/WindowsEdgeLight/AppSettings.cs
+++ b/WindowsEdgeLight/AppSettings.cs
@@ -20,6 +20,22 @@ public class AppSettings
///
public bool ExcludeFromCapture { get; set; } = true;
+ ///
+ /// Whether the edge light is on or off (persisted across restarts)
+ ///
+ public bool IsLightOn { get; set; } = true;
+
+ ///
+ /// Brightness/opacity of the edge light, in the range [0.2, 1.0]
+ ///
+ public double Brightness { get; set; } = 1.0;
+
+ ///
+ /// Color temperature of the edge light, in the range [0.0, 1.0]
+ /// where 0.0 = coolest (blue-white) and 1.0 = warmest (amber)
+ ///
+ public double ColorTemperature { get; set; } = 0.5;
+
///
/// Load settings from disk
///
diff --git a/WindowsEdgeLight/MainWindow.xaml.cs b/WindowsEdgeLight/MainWindow.xaml.cs
index c24a3c7..865ee10 100644
--- a/WindowsEdgeLight/MainWindow.xaml.cs
+++ b/WindowsEdgeLight/MainWindow.xaml.cs
@@ -156,6 +156,11 @@ public MainWindow()
// Load settings
settings = AppSettings.Load();
+ // Restore persisted state
+ isLightOn = settings.IsLightOn;
+ currentOpacity = settings.Brightness;
+ _colorTemperature = settings.ColorTemperature;
+
SetupNotifyIcon();
}
@@ -314,6 +319,16 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
// Apply exclude from capture setting
ApplyExcludeFromCapture();
+ // Apply persisted brightness and color temperature
+ EdgeLightBorder.Opacity = currentOpacity;
+ SetColorTemperature(_colorTemperature);
+
+ // Apply persisted on/off state
+ if (!isLightOn)
+ {
+ EdgeLightBorder.Visibility = Visibility.Collapsed;
+ }
+
InstallMouseHook();
}
@@ -673,6 +688,9 @@ private void ToggleLight()
// Update all additional monitor windows
UpdateAdditionalMonitorWindows();
+
+ settings.IsLightOn = isLightOn;
+ settings.Save();
}
public void HandleToggle()
@@ -776,6 +794,9 @@ public void IncreaseBrightness()
// Update all additional monitor windows
UpdateAdditionalMonitorWindows();
+
+ settings.Brightness = currentOpacity;
+ settings.Save();
}
public void DecreaseBrightness()
@@ -785,6 +806,9 @@ public void DecreaseBrightness()
// Update all additional monitor windows
UpdateAdditionalMonitorWindows();
+
+ settings.Brightness = currentOpacity;
+ settings.Save();
}
private void UpdateAdditionalMonitorWindows()
@@ -869,6 +893,9 @@ System.Windows.Media.Color Lerp(System.Windows.Media.Color a, System.Windows.Med
// Update all additional monitor windows
UpdateAdditionalMonitorWindows();
+
+ settings.ColorTemperature = _colorTemperature;
+ settings.Save();
}
public void MoveToNextMonitor()