Skip to content

KiraFR/TrayDisplaySwitch

Repository files navigation

TrayDisplaySwitch

A lightweight Windows system tray application that lets you quickly switch between display modes (PC only, Duplicate, Extend, Second screen only) using the built-in DisplaySwitch.exe tool.

✨ Features

  • Runs silently in the system tray (notification area).
  • Simple context menu with options:
    • PC screen only (/internal)
    • Duplicate (/clone)
    • Extend (/extend)
    • Second screen only (/external)
    • Open Display Settings (shortcut to Windows settings)
    • Exit
  • Auto-scaled tray icon (light and dark mode support).
  • Prevents multiple instances via a global mutex.
  • Secure by design:
    • Uses absolute path to DisplaySwitch.exe.
    • Only allows whitelisted arguments.

🖥️ Requirements

⚙️ Build

# Clone the repo
git clone https://github.com/KiraFR/TrayDisplaySwitch.git
cd TrayDisplaySwitch

# Build in Release mode
dotnet build -c Release

# Run directly
dotnet run -c Release

# Or start the built .exe
./bin/Release/net8.0-windows/TrayDisplaySwitch.exe

📦 Packaging

To create a single self-contained executable:

dotnet publish -c Release -r win-x64 `
  -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true

The binary will be located at:

bin/Release/net8.0-windows/win-x64/publish/TrayDisplaySwitch.exe

🚀 Usage

  1. Launch TrayDisplaySwitch.exe.
  2. The app appears in the system tray (near the clock).
  3. Right-click the icon → select your desired display mode.

⚡ Auto Start on Windows

You can configure TrayDisplaySwitch to start automatically when Windows boots.

🗂️ Using the Startup Folder (simple)

  1. Press Win + R, type shell:startup, and press Enter.
  2. Copy the TrayDisplaySwitch.exe file (or a shortcut to it) into the Startup folder that opens.
  3. Restart your computer → the app will now launch automatically.

🔒 Security Notes

  • Absolute path to DisplaySwitch.exe prevents path hijacking.
  • Hardcoded whitelist of valid arguments.
  • Runs as asInvoker (no elevated privileges required).
  • Embedded icon (no external resources).

📜 License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages