Files
EonaCat.RdpColorizer/README.md
T
2026-08-06 22:29:07 +02:00

4.6 KiB

EonaCat RDP Colorizer

A Windows utility that colors the title bar of Remote Desktop windows and overlays a small colored tag (e.g. PROD, DEV-DB1) on the caption, so you can tell multiple RDP sessions apart at a glance. It runs in the background, remembers which color/tag belongs to which server, and automatically re-applies that tag any time a matching RDP window shows up - including after you restart the app, and for windows opened outside the app entirely.

A note on "running as a service"

A true Windows Service (the kind registered with the Service Control Manager) runs in Session 0, which has been isolated from the interactive desktop since Windows Vista. A Session 0 process cannot see or draw on windows in your logon session at all - this is an OS-level security boundary, not something that can be coded around. So a real SCM service could never color or overlay another window's title bar.

What actually achieves the goal - always running, no manual relaunching, automatic re-tagging - is a background app that starts at logon inside your own session. That's what this app now does:

  • It starts hidden in the system tray (no window, no taskbar entry) when launched with --background, or normally shows its control panel when opened by hand.
  • Closing the window just hides it to the tray; the watcher keeps running until you choose Exit from the tray icon's menu.
  • Check Start with Windows in the app to have it launch automatically at logon (writes a HKCU\...\Run entry pointing at the exe with --background - no admin rights required).

If your environment specifically requires an SCM-registered service (e.g. for a policy or monitoring reason), that service could still exist to supervise/restart this tray app, but it would not be able to perform the window coloring itself.

How the coloring and tagging work

  1. Native caption color - DwmSetWindowAttribute with DWMWA_CAPTION_COLOR / DWMWA_TEXT_COLOR. Only honored on Windows 11 (build 22000+); ignored on Windows 10.
  2. Overlay tag label - a small always-on-top badge window positioned over the caption bar, showing your text on your chosen color. Works on any Windows version and follows the RDP window as it moves, resizes, or restores (hidden while minimized).

Auto re-attach by server / IP

  • Whenever you tag a connection (Launch or Attach), the target (server name or IP) plus your chosen label/color is saved to %AppData%\EonaCat.RdpColorizer\profiles.json.
  • A background watcher scans for RDP windows system-wide every second. For each one it doesn't recognize yet, it resolves the actual connection target - first by reading the mstsc.exe process's command line (/v:target) via WMI, falling back to parsing the window title if that fails (e.g. if mstsc.exe is running elevated or under a different account than this app).
  • If the resolved target matches a saved profile, the tag/color is applied automatically - no manual step needed, including for connections opened straight from the Start menu or a saved .rdp file.
  • Use Manage saved profiles... to review or delete remembered server → tag mappings.

Requirements

Build & run

cd EonaCat.RdpColorizer
dotnet build
dotnet run

Or publish a standalone exe:

dotnet publish -c Release -r win-x64 --self-contained false

Using it

  1. Enter a server name/IP and a short tag, pick a color, then click Launch new tagged connection (runs mstsc.exe /v:target) or Tag active RDP window to attach to one already open.
  2. That server/tag/color is now remembered - close and reopen the app (or just leave it running in the tray) and any future RDP window to that same server gets tagged automatically.
  3. Tick Start with Windows so this happens without you having to open the app at all.

Notes / limitations

  • Windows caption theming (DWMWA_CAPTION_COLOR) is Windows 11 only; there is no public equivalent for Windows 10 - the overlay tag is your cross-version fallback.
  • The overlay tag is a separate always-on-top window layered over the caption, so it will show up as its own tiny entry in things like Alt+Tab previews - expected behavior, not a bug.
  • Command-line resolution via WMI requires the watcher to have permission to query the mstsc.exe process; if it's elevated or owned by another user, the watcher falls back to matching on the window title instead (which shows the resolved computer name rather than the raw IP you typed - keep that in mind when naming profiles for IP-based targets).