Skip to content

andrewtheart/MonitorBrightnessControl

Repository files navigation

Monitor Brightness Control

A Windows app for adjusting brightness independently for each attached monitor using DDC/CI.

Monitor Brightness Control

License

This project is licensed under the MIT License. See LICENSE.

Prerequisites

Running the published app

  • Windows 10/11.
  • Windows App Runtime 2.x installed. The app uses Windows App SDK 2.0.1.
  • External monitors must support DDC/CI brightness control for the sliders/CLI brightness commands to work.

The published app is self-contained and Native AOT compiled, so it does not require installing the .NET runtime separately. The AOT version also starts significantly faster than a standard JIT build.

Building or running from source

  • .NET 10 SDK 10.0.300 or newer. The build scripts below check for this automatically and offer to install it via winget if it is missing.
  • Windows SDK 10.0.26100.0 or newer.
  • Windows App SDK build support for WinUI 3 projects.

The project targets:

net10.0-windows10.0.26100.0
Microsoft.WindowsAppSDK 2.0.1

Publishing with Native AOT

  • .NET 10 SDK with Native AOT toolchain support.
  • Windows C++ build tools required by Native AOT publishing.
  • A supported runtime identifier, for example win-x64.

Dependencies

The only external NuGet dependency is Microsoft.WindowsAppSDK 2.0.1 (WinUI 3), which provides the UI framework, windowing, and XAML runtime.

All other functionality uses built-in Windows and .NET APIs:

  • DDC/CI brightness controldxva2.dll (GetMonitorBrightness, SetMonitorBrightness, SetVCPFeature)
  • Window managementuser32.dll (subclassing, foreground, DPI)
  • System tray iconshell32.dll (Shell_NotifyIcon)
  • Monitor EDID names — Windows registry (Microsoft.Win32.Registry)

WinUI 3 app features

  • Per-monitor brightness sliders.
  • Monitor names resolved from EDID/Windows display data when available.
  • Monitor resolution and display index shown in each tile.
  • Compact monitor tiles with automatic window sizing.
  • Configurable threshold for how many monitor tiles are shown before the list scrolls. The default is 4.
  • Identify button that shows a numbered overlay on each monitor.
  • Settings panel opened from the gear button.
  • Configurable global hotkey to bring the app to the foreground.
  • Keyboard-first brightness control for power users.
  • System tray support:
    • Closing the window minimizes to the tray.
    • Single-click or double-click the tray icon restores the window.
    • First-launch prompt explaining close-to-tray behavior and offering to open settings for hotkey configuration.
  • Settings are stored next to the executable in monitor_brightness_settings.json.
  • Diagnostic warnings are logged to %LOCALAPPDATA%\MonitorBrightness\monitor_brightness.log.
  • Custom monitor/sun app icon in the title bar and system tray.

Keyboard controls

The main window can be controlled without clicking the sliders:

  • 1-9 - select monitor 1 through 9.
  • 0 or A - select all brightness-capable monitors.
  • Up, Right, or + - increase the selected monitor brightness.
  • Down, Left, or - - decrease the selected monitor brightness.
  • Ctrl + adjustment key - fine adjustment by 1%.
  • adjustment key alone - normal adjustment by 5%.
  • Shift + adjustment key - coarse adjustment by 10%.
  • Ctrl+Shift + adjustment key - large adjustment by 25%.
  • PageUp / PageDown - coarse 10% up/down.
  • Home - set selected target to minimum brightness.
  • End - set selected target to maximum brightness.

The selected monitor tile is highlighted. When all monitors are selected, all brightness-capable tiles are highlighted and adjustments apply to all of them at the same time.

Command-line usage

Run from the repository root:

dotnet run --project MonitorBrightness -- --help
dotnet run --project MonitorBrightness -c Release -- --help

Or use the convenience scripts:

.\run.ps1 --help
.\run.bat --help

Published executable examples:

MonitorBrightness.exe --list                                        # List all detected monitors and show their current brightness levels
MonitorBrightness.exe --get                                         # Show current brightness for all monitors
MonitorBrightness.exe --get --monitor 2                             # Show the current brightness for monitor 2
MonitorBrightness.exe --setlevel --monitors 1 --level 75            # Set monitor 1 brightness to 75%
MonitorBrightness.exe --setlevel --monitors all --level 50          # Set all brightness-capable monitors to 50%
MonitorBrightness.exe --setlevel --monitors 1,3 --level 75          # Set monitors 1 and 3 to 75%
MonitorBrightness.exe --setlevel --monitors 1-4 --level 60          # Set monitors 1 through 4 to 60%
MonitorBrightness.exe --setlevel --monitors 1 3 4 --level 80        # Set monitors 1, 3, and 4 to 80%
MonitorBrightness.exe --identify                                    # Print monitor identification information to help match monitor numbers

Commands:

  • --list, -l - list monitors and current brightness.
  • --get [--monitor <n>] - get brightness for all monitors, or for a specific monitor with --monitor.
  • --setlevel --monitors <targets> --level <value> - set brightness to 0-100.
    • Targets can be a single monitor (1), all monitors (all), comma-separated (1,3), a range (1-4), or space-separated (1 3 4).
  • --identify, --id - print monitor identification information.
  • --help, /help, -h, -?, /? - show CLI help. If any help flag is present, all other CLI flags are ignored.

Building

Run the PowerShell script for the target you want:

.\build-debug.ps1      # Debug build
.\build-release.ps1    # Release build
.\build-aot.ps1        # Native AOT publish (Release)

Each script checks for the required .NET 10 SDK and offers to install it if it is not found.

Test

dotnet test MonitorBrightnessControl.slnx -c Debug
dotnet test MonitorBrightnessControl.slnx -c Release

Publish with Native AOT

Publishing the app performs Native AOT compilation. To compile with AOT, run:

cd MonitorBrightness
dotnet publish -c Release -r win-x64

The published executable is written to:

MonitorBrightness\bin\Release\net10.0-windows10.0.26100.0\win-x64\publish\MonitorBrightness.exe

Notes

Brightness control requires DDC/CI support from the monitor and connection path. Most external monitors connected via DisplayPort or HDMI support this, but some displays, adapters, docks, or laptop internal panels do not expose DDC/CI brightness control.

About

Per-monitor brightness control for Windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors