Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions WindowsEdgeLight/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ public class AppSettings
/// </summary>
public bool ExcludeFromCapture { get; set; } = true;

/// <summary>
/// Whether the edge light is on or off (persisted across restarts)
/// </summary>
public bool IsLightOn { get; set; } = true;

/// <summary>
/// Brightness/opacity of the edge light, in the range [0.2, 1.0]
/// </summary>
public double Brightness { get; set; } = 1.0;

/// <summary>
/// Color temperature of the edge light, in the range [0.0, 1.0]
/// where 0.0 = coolest (blue-white) and 1.0 = warmest (amber)
/// </summary>
public double ColorTemperature { get; set; } = 0.5;

/// <summary>
/// Load settings from disk
/// </summary>
Expand Down
27 changes: 27 additions & 0 deletions WindowsEdgeLight/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public MainWindow()
// Load settings
settings = AppSettings.Load();

// Restore persisted state
isLightOn = settings.IsLightOn;
currentOpacity = settings.Brightness;
_colorTemperature = settings.ColorTemperature;

SetupNotifyIcon();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -673,6 +688,9 @@ private void ToggleLight()

// Update all additional monitor windows
UpdateAdditionalMonitorWindows();

settings.IsLightOn = isLightOn;
settings.Save();
}

public void HandleToggle()
Expand Down Expand Up @@ -776,6 +794,9 @@ public void IncreaseBrightness()

// Update all additional monitor windows
UpdateAdditionalMonitorWindows();

settings.Brightness = currentOpacity;
settings.Save();
}

public void DecreaseBrightness()
Expand All @@ -785,6 +806,9 @@ public void DecreaseBrightness()

// Update all additional monitor windows
UpdateAdditionalMonitorWindows();

settings.Brightness = currentOpacity;
settings.Save();
}

private void UpdateAdditionalMonitorWindows()
Expand Down Expand Up @@ -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()
Expand Down