Skip to content

Repository files navigation

SetPrimaryMonitor

A tiny Windows tool that adds a desktop right-click option to make the monitor you clicked on the primary display. Useful if you switch your primary screen often and don't want to open Settings every time.

Right-click an empty spot on the desktop, and the monitor under your cursor becomes primary — the taskbar and Start menu move there. A small note appears on the new primary screen to confirm. Right-clicking on the monitor that's already primary does nothing.

Requirements

  • Windows 10 or 11
  • .NET 9 (SDK to build, Runtime to run) — the build is framework-dependent, so it uses the .NET runtime already on your machine.

Install

From the project folder, build the executable and register the menu entry:

dotnet publish -c Release -o publish
.\install.ps1

install.ps1 adds a registry key under HKCU (no admin rights needed) that points to the published publish\SetPrimaryMonitor.exe. Pass -ExePath <path> if your exe lives somewhere else.

To remove the entry again:

.\uninstall.ps1

Usage

Right-click the desktop background → Show more options → the entry. That's it — the monitor you clicked becomes primary. The label follows your Windows display language — it is provided in English, Deutsch, Français, Español, Italiano; any other language falls back to English.

The entry sits in the classic "Show more options" menu, not the top-level Windows 11 context menu.

How it works

  • It finds the monitor under the cursor with GetCursorPos / MonitorFromPoint.
  • It switches the primary display through the CCD API (QueryDisplayConfig / SetDisplayConfig), which applies the whole monitor layout in one atomic step. An earlier version used ChangeDisplaySettingsEx, but some drivers reject it because the in-between state (two monitors at 0,0) fails per call — SetDisplayConfig avoids that.
  • The menu label is a native string resource (MUIVerb) embedded in the exe, which the shell resolves in the current OS language at display time.
  • There's no background process and no network access. The context-menu entry runs the small exe on demand and it exits right after.

Notes

  • The position math (shifting all displays so the target lands at 0,0) has unit tests under tests/. The actual switch depends on your hardware and drivers.
  • Built with C# / .NET 9 (net9.0-windows, WinForms only for the confirmation popup).

License

Released under the MIT License.

About

Right-click the desktop to make that monitor your primary display (Windows). Context-menu label follows your display language (en/de/fr/es/it).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages