PowerModeSlider

June 23, 2026 Β· View on GitHub

A lightweight Windows 11 system tray application for quickly switching power modes.

.NET 10 Windows 11 WinUI 3

Overview

PowerModeSlider flyout showing the power-mode slider and keep-awake toggle in the system tray

PowerModeSlider lives in your system tray and provides a simple slider flyout to switch between Windows 11 power modes instantlyβ€”no need to dig through Settings.

Features

  • πŸ”‹ System Tray App – Runs quietly in the background
  • ⚑ One-Click Access – Click the tray icon to show/hide the slider
  • 🎚️ Simple Slider UI – Drag to switch between three power modes
  • β˜• Keep Awake – Toggle the coffee button to stop the machine sleeping (ON forever / OFF, no timers)
  • πŸ”„ Dynamic Icon – Tray icon updates to reflect current power mode, with an amber badge while keep-awake is on
  • πŸͺŸ Native Look – Uses Windows 11 Acrylic backdrop

Power Modes

ModeDescription
πŸ”‹ Best Power EfficiencySaves power by reducing performance and brightness
βš–οΈ BalancedFull performance when needed, saves power when idle
⚑ Best PerformanceMaximum performance and screen brightness

How It Works

The app uses the official Windows Power Management APIs (PowerSetUserConfiguredACPowerMode / PowerSetUserConfiguredDCPowerMode) introduced in Windows 11 to change power modes for both AC (plugged in) and DC (battery) states.

Requirements

  • Windows 11 (Build 22000 or later)
  • .NET 10 Runtime

Usage

  1. Launch the app – it minimizes to the system tray
  2. Left-click the tray icon to open the power slider
  3. Drag the slider to your desired power mode
  4. Right-click the tray icon to exit

Development

This project supports the Windows App Development CLI (winapp), which lets you build and run the packaged WinUI 3 app directly from the terminal β€” no Visual Studio required.

Prerequisites

Install the .NET 10 SDK and the winapp CLI:

winget install Microsoft.DotNet.SDK.10 --source winget
winget install Microsoft.winappcli --source winget

Run (dotnet run)

The project includes the Microsoft.Windows.SDK.BuildTools.WinApp NuGet package, which hooks dotnet run into winapp run automatically. Run from the PowerModeSlider/ sub-folder, passing a runtime identifier (the packaged app cannot build as the default AnyCPU):

cd PowerModeSlider
dotnet run -r win-x64

This registers a loose-layout package with Windows and launches the app with full package identity.

Run (manual winapp)

Build first, then invoke winapp run pointing at the build output:

dotnet build -c Debug -r win-x64
winapp run .\bin\Debug\net10.0-windows10.0.19041.0\win-x64

Package for distribution (MSIX)

Build in Release, then pack and sign. Because the app's Package.appxmanifest declares Publisher="CN=gungaretti", the signing certificate's subject must match that publisher and must be trusted on the machine, or Windows refuses to install the package (0x800B010A). winapp pack handles this for you β€” it reads the manifest, generates a matching development certificate, trusts it, and signs the package in one step:

dotnet build -c Release -r win-x64
winapp pack .\bin\Release\net10.0-windows10.0.19041.0\win-x64 --generate-cert --install-cert

Then install the generated .msix (e.g. Add-AppxPackage .\PowerModeSlider_*.msix).

Prefer to manage the certificate explicitly? Generate one whose publisher matches the manifest, trust it, then sign with it:

winapp cert generate --manifest .\Package.appxmanifest --install --output .\devcert.pfx --if-exists skip
dotnet build -c Release -r win-x64
winapp pack .\bin\Release\net10.0-windows10.0.19041.0\win-x64 --cert .\devcert.pfx

Use winapp cert info .\devcert.pfx to confirm the certificate subject matches the manifest publisher before signing.

Tip: Increment the Version in Package.appxmanifest before re-packing to allow Windows to update the installed package.

Project Structure

PowerModeSlider/
β”œβ”€β”€ PowerModeSlider/    # WinUI 3 tray application
β”œβ”€β”€ PowerModeLib/       # .NET library for power mode APIs
└── KeepAwakeLib/       # .NET library for keep-awake (SetThreadExecutionState)