Skip to content
Merged
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
12 changes: 10 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'


- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~\.nuget\packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore dependencies
run: dotnet restore WindowsEdgeLight/WindowsEdgeLight.csproj

Expand Down Expand Up @@ -130,7 +138,7 @@ jobs:

- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: artifacts/*.zip
generate_release_notes: true
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
pull_request:
push:
branches:
- master

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~\.nuget\packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore
run: dotnet restore WindowsEdgeLight.sln

- name: Build
run: dotnet build WindowsEdgeLight.sln --configuration Release --no-restore

- name: Test
run: dotnet test WindowsEdgeLight.sln --configuration Release --no-build
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Windows Edge Light

A lightweight WPF application that adds a customizable glowing edge light effect around your primary monitor on Windows. Perfect for ambient lighting during video calls, streaming, or just adding a professional touch to your workspace.
A lightweight WPF application that adds a customizable glowing edge light effect around your monitors on Windows. Perfect for ambient lighting during video calls, streaming, or just adding a professional touch to your workspace.

## Features

- **Automatic Updates**: Built-in update system checks GitHub Releases for new versions
- **Primary Monitor Display**: Automatically detects and displays on your primary monitor, even in multi-monitor setups
- **Multi-Monitor Support**: Display on your primary monitor, switch to another monitor, or show on all monitors simultaneously
- **DPI Aware**: Properly handles high-DPI displays (4K monitors with scaling)
- **Fluent Design**: Modern UX that fits in with the Windows look and feel
- **Click-Through Transparency**: Overlay doesn't interfere with your work - all clicks pass through to applications beneath
- **Customizable Brightness**: Adjust opacity with easy-to-use controls
- **Adjustable Color Temperature**: Shift the edge light from cooler (blue-ish) to warmer (amber) tones
- **Adjustable Color Temperature**: Shift the edge light from cooler (blue-ish) to warmer (amber) tones
- **Toggle On/Off**: Quickly enable or disable the edge light effect
- **Hideable Controls**: Hide the control toolbar for a cleaner look, restore via tray menu
- **Always On Top**: Stays visible above all other windows
- **Persistent Settings**: Brightness, color temperature, on/off state, and preferences are saved across restarts
- **Settings Window**: Dedicated settings panel with sliders and control-bar customization
- **Exclude from Screen Capture**: Optional setting to hide the edge light from screen sharing (Teams, Zoom) and screenshots
- **Keyboard Shortcuts**:
- `Ctrl+Shift+L` - Toggle light on/off
Expand Down Expand Up @@ -82,19 +84,19 @@ The executable will be in `bin\Release\net10.0-windows\win-x64\publish\WindowsEd
3. Control toolbar appears at the bottom center with these buttons:
- 🔅 **Decrease Brightness** - Reduces opacity
- 🔆 **Increase Brightness** - Increases opacity
- 🌡️ **Cooler Color** - Shifts the glow towards a cooler, blue-ish white
- 🔥 **Warmer Color** - Shifts the glow towards a warmer, amber tone
- ❄️ **Cooler Color** - Shifts the glow towards a cooler, blue-ish white
- 💡 **Toggle Light** - Turn the effect on/off
- 🖥️ **Switch Monitor** - Move to next monitor (if multiple monitors)
- 🖥️🖥️ **All Monitors** - Show on all monitors (if multiple monitors)
- 🎥 **Exclude from Capture** - Hide from screen sharing and screenshots
- ⚙️ **Settings** - Adjust appearance, capture exclusion, and control visibility
- ✖ **Exit** - Close the application
4. Hide the control toolbar for a cleaner look using the tray menu (right-click tray icon → "Hide Controls")

### Screen Sharing Mode

When sharing your screen on video conferencing apps (Teams, Zoom, etc.), you may want the edge light to be visible to you but invisible to viewers. Enable **"Exclude from Screen Capture"** via:
- Click the 🎥 button in the control toolbar, or
- Open ⚙️ **Settings** from the control toolbar and enable **Exclude from Screen Capture**, or
- Right-click the tray icon → "Exclude from Screen Capture"

**Note**: When this setting is enabled, the edge light will also be excluded from screenshots taken with Windows Snipping Tool, PrintScreen, or other capture tools.
Expand Down Expand Up @@ -124,11 +126,11 @@ When sharing your screen on video conferencing apps (Teams, Zoom, etc.), you may

## Multi-Monitor Support

The application specifically targets the **primary monitor** in your display setup:
- Automatically detects primary monitor position and dimensions
- Correctly handles DPI scaling (e.g., 150%, 200% on 4K displays)
- Works with any monitor arrangement (horizontal, vertical, mixed)
- Does not span across multiple monitors
The application supports flexible multi-monitor configurations:
- Starts on the primary monitor
- Switches between connected monitors from the toolbar or tray menu
- Can display the edge light on every connected monitor simultaneously
- Handles per-monitor DPI scaling and mixed monitor arrangements

## Development

Expand Down
137 changes: 137 additions & 0 deletions WindowsEdgeLight.Tests/AppSettingsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
using System.Text.Json;
using Xunit;

namespace WindowsEdgeLight.Tests;

public sealed class AppSettingsTests : IDisposable
{
private readonly string tempDirectory = Path.Combine(
Path.GetTempPath(),
$"WindowsEdgeLight.Tests-{Guid.NewGuid():N}");

private string SettingsPath => Path.Combine(tempDirectory, "settings.json");

[Fact]
public void DefaultsMatchApplicationDefaults()
{
var settings = new AppSettings();

Assert.True(settings.ExcludeFromCapture);
Assert.True(settings.IsLightOn);
Assert.Equal(1.0, settings.Brightness);
Assert.Equal(0.5, settings.ColorTemperature);
Assert.True(settings.ShowToggleButton);
Assert.True(settings.ShowBrightnessButtons);
Assert.True(settings.ShowColorTempButtons);
Assert.True(settings.ShowMonitorControlButtons);
}

[Fact]
public void MissingFileReturnsDefaults()
{
var settings = AppSettings.LoadFrom(SettingsPath);

Assert.Equal(1.0, settings.Brightness);
Assert.True(settings.IsLightOn);
}

[Fact]
public void SaveAndLoadRoundTripsAllProperties()
{
var expected = new AppSettings
{
ExcludeFromCapture = false,
IsLightOn = false,
Brightness = 0.7,
ColorTemperature = 0.3,
ShowToggleButton = false,
ShowBrightnessButtons = false,
ShowColorTempButtons = false,
ShowMonitorControlButtons = false
};

expected.SaveTo(SettingsPath);
var actual = AppSettings.LoadFrom(SettingsPath);

Assert.Equal(expected.ExcludeFromCapture, actual.ExcludeFromCapture);
Assert.Equal(expected.IsLightOn, actual.IsLightOn);
Assert.Equal(expected.Brightness, actual.Brightness);
Assert.Equal(expected.ColorTemperature, actual.ColorTemperature);
Assert.Equal(expected.ShowToggleButton, actual.ShowToggleButton);
Assert.Equal(expected.ShowBrightnessButtons, actual.ShowBrightnessButtons);
Assert.Equal(expected.ShowColorTempButtons, actual.ShowColorTempButtons);
Assert.Equal(expected.ShowMonitorControlButtons, actual.ShowMonitorControlButtons);
Assert.False(File.Exists(SettingsPath + ".tmp"));
}

[Fact]
public void SaveReplacesExistingFile()
{
Directory.CreateDirectory(tempDirectory);
File.WriteAllText(SettingsPath, """{"Brightness":0.2}""");
var settings = new AppSettings { Brightness = 0.8 };

settings.SaveTo(SettingsPath);

Assert.Equal(0.8, AppSettings.LoadFrom(SettingsPath).Brightness);
Assert.False(File.Exists(SettingsPath + ".tmp"));
}

[Fact]
public void SaveCreatesParentDirectory()
{
var nestedPath = Path.Combine(tempDirectory, "nested", "settings.json");

new AppSettings().SaveTo(nestedPath);

Assert.True(File.Exists(nestedPath));
}

[Fact]
public void CorruptJsonReturnsDefaultsAndDeletesFile()
{
Directory.CreateDirectory(tempDirectory);
File.WriteAllText(SettingsPath, "{ invalid");

var settings = AppSettings.LoadFrom(SettingsPath);

Assert.Equal(1.0, settings.Brightness);
Assert.False(File.Exists(SettingsPath));
}

[Fact]
public void CommentsAndTrailingCommasAreAccepted()
{
Directory.CreateDirectory(tempDirectory);
File.WriteAllText(SettingsPath, """
{
// User-edited settings remain supported.
"Brightness": 0.6,
"ColorTemperature": 0.2,
}
""");

var settings = AppSettings.LoadFrom(SettingsPath);

Assert.Equal(0.6, settings.Brightness);
Assert.Equal(0.2, settings.ColorTemperature);
}

[Fact]
public void SavedJsonIsIndented()
{
new AppSettings().SaveTo(SettingsPath);

var json = File.ReadAllText(SettingsPath);
Assert.Contains(Environment.NewLine, json);
Assert.NotNull(JsonSerializer.Deserialize<AppSettings>(json));
}

public void Dispose()
{
if (Directory.Exists(tempDirectory))
{
Directory.Delete(tempDirectory, recursive: true);
}
}
}
24 changes: 24 additions & 0 deletions WindowsEdgeLight.Tests/WindowsEdgeLight.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\WindowsEdgeLight\WindowsEdgeLight.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions WindowsEdgeLight.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsEdgeLight", "WindowsEdgeLight\WindowsEdgeLight.csproj", "{C2187EC4-5511-1F4A-A7C5-D7D114D039DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsEdgeLight.Tests", "WindowsEdgeLight.Tests\WindowsEdgeLight.Tests.csproj", "{B1E2F3A4-6622-2F5B-B8D6-E8E225E04AED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -14,6 +16,10 @@ Global
{C2187EC4-5511-1F4A-A7C5-D7D114D039DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2187EC4-5511-1F4A-A7C5-D7D114D039DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2187EC4-5511-1F4A-A7C5-D7D114D039DC}.Release|Any CPU.Build.0 = Release|Any CPU
{B1E2F3A4-6622-2F5B-B8D6-E8E225E04AED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1E2F3A4-6622-2F5B-B8D6-E8E225E04AED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1E2F3A4-6622-2F5B-B8D6-E8E225E04AED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1E2F3A4-6622-2F5B-B8D6-E8E225E04AED}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading
Loading