ENGINEERING NOTES · TECHNICAL DECISION

Why we built a native WPF tray app instead of an Electron window

The short answer

TrayTool is a process meant to stay resident in the Windows notification area for an entire working session, not a content window you open and close. That changes the cost equation: a resident app pays its memory and disk price every hour, while a document-style app pays it per visit. We chose native WPF on .NET 8 so the host runs on the operating system's own desktop runtime instead of shipping a second browser engine, and so it can speak the Windows tray API directly. This note explains that decision with the numbers we actually publish — and is explicit about the Electron measurements we have not taken.

On this page

  1. What “native WPF” actually means here
  2. A tray app is a resident process, not a page
  3. Why Electron did not fit the job
  4. The tray is a Windows API surface, not a web page
  5. The resource budget we are willing to publish
  6. What we gave up to go native
  7. Where the current build actually stands

What “native WPF” actually means here

WPF, Windows Presentation Foundation, is the desktop UI framework that ships as part of .NET for Windows. A WPF application compiles to managed code that runs on the .NET runtime and renders through the operating system's own graphics stack, rather than through an embedded web browser. TrayTool's own description is precise on this point: a native WPF host that lives in your system tray, running on Windows 10 (build 19041 and later) or Windows 11, x64, with the .NET 8 runtime bundled inside the installer.

The word “native” is doing real work, so it is worth not overstating it. WPF is not unmanaged C++: it runs on a managed runtime with garbage collection. What “native” signals here is that there is no separate Chromium engine and no Node.js process in the stack. The process you launch is a Windows desktop process using the OS desktop stack, and the runtime underneath it is .NET, which the installer carries with it so the machine does not need a pre-installed framework.

That choice shows up in how the program is measured in the repository. The audited snapshot from 2026-09-07 describes TrayTool as a 234,980-line C# WPF host across 22 modules and 512 files, presenting a 71-command surface across 15 domains with six built-in plugins. It is a sizeable desktop codebase, but it is one codebase running on one runtime, rather than a web application wrapped in a second, bundled browser.

A tray app is a resident process, not a page

The first reason the framework question matters is what TrayTool does all day. A conventional document application — an editor, a browser tab, a settings window — is opened, used, and closed. Its overhead is paid for the duration of a task. A tray host has the opposite lifecycle. By design its window is hidden while the process stays alive, waiting in the notification area so commands, plugins, and later agent invocations have somewhere to land without a cold start.

The technical mechanics of that lifecycle are not glamorous, but they define the requirements. In WPF the application keeps running after its last window closes only when the shutdown mode is set to an explicit, non-default value; the default behaviour would terminate the process the moment the window went away. The window itself is hidden rather than closed, with its taskbar button removed through the window-show settings, while the notification icon remains the only visible surface. A separate single-instance guard makes sure every launch lands in the already-running process instead of starting a second resident copy. The dedicated WPF tray guide walks through these mechanics in detail; the point here is what they imply.

A process engineered to be hidden-but-alive for an entire session multiplies the cost of its baseline footprint by the number of hours in that session. A heavier runtime is something a document app can get away with because the user closes it. A tray resident cannot. That single fact — residency — is the spine of every other decision in this note.

Why Electron did not fit the job

Electron is a sensible tool for a specific job: shipping a web-technology interface as a desktop application without maintaining separate native front ends. It does that by bundling Chromium and Node.js alongside the application, so the same HTML, CSS, and JavaScript runs identically on Windows, macOS, and Linux. That cross-platform reuse is the genuine benefit, and for content-heavy, form-driven applications it often outweighs the cost.

TrayTool is not that application, and three properties of the framework worked against our requirements. These are structural observations about how Electron is built, not benchmark claims — we have not measured an Electron build of this product, and you will find no invented comparison numbers in this note.

One resident process would carry a full browser engine

Every Electron application ships its own Chromium. The renderer that displays a settings pane in a tray tool is, in runtime terms, the same engine that displays a complex web application in a browser. For a process whose window spends most of its life hidden, paying to carry and initialise a complete browser runtime sits awkwardly against the residency argument above: the engine is resident even when almost nothing is being rendered. A WPF host instead renders through the Windows desktop stack that is already part of the operating system.

Two runtimes where the job needed one

Electron pairs a Chromium renderer with a Node.js main process. The desktop capabilities — files, processes, the notification area — are reached across that boundary from JavaScript. TrayTool's core is a C# command plane talking directly to Windows and to .NET libraries. Building it on Electron would mean expressing that command plane in JavaScript inside Node, or maintaining native addons anyway, which erodes much of the framework's simplicity. Keeping the host in a single managed runtime with direct Windows access was the shorter, more auditable path for a tool whose central feature is a permission-gated command plane.

The honest-budget constraint

TrayTool publishes concrete resource requirements and an installer size up front, and the project treats “no Electron” as part of that honesty rather than a slogan. A framework that structurally bundles a second browser makes a small, predictable resident budget harder to defend, because a large part of the baseline is fixed by the framework rather than chosen by the team. We wanted the published numbers to reflect decisions we controlled, not the floor of a runtime we did not need.

None of this is a verdict that Electron is bad. It is a statement about fit. If the product were a cross-platform content window whose interface already existed as a web app, the trade could easily point the other way. For a Windows-only, always-resident, Windows-API-centred tray host, it pointed toward WPF.

The tray is a Windows API surface, not a web page

A tray application's defining feature is also its most platform-specific. The notification area, the icon that lives there, the context menu it opens, and the show-versus-close behaviour are all Windows shell concepts. WPF reaches them through the desktop framework layer — in practice, via the Windows Forms notification component interop that the WPF ecosystem standardised on, because WPF itself never shipped a built-in tray-icon class. That interop is a thin, well-understood bridge to the shell, not an embedded browser.

This matters for the framework decision because the icon in the notification area is the product, not a side feature. The whole value proposition is a resident host whose primary surface is the tray: a left-click menu of commands, a right-click context menu, and an optional main window for richer UI. Building the central interaction on the platform's own shell API keeps the path from the user's click to the command plane short and keeps the behaviour — single instance, hidden window, explicit shutdown — under direct control. Reaching the same shell APIs from an Electron main process is possible, but it adds a JavaScript-to-native hop for the one thing the application exists to do.

The companion WPF tray guide covers the actual mechanics: why there is no native WPF NotifyIcon, the two shutdown and taskbar settings that trip up most first implementations, and how a production host layers single-instance discipline and an audit log on top. Here the relevant conclusion is narrower — when the tray is the product rather than an afterthought, sitting directly on the Windows API surface is the lower-friction position.

The resource budget we are willing to publish

An architecture note should rest on numbers someone can check, not adjectives. The figures below are the ones the download page and the product page publish for the current Windows build. They are stated as requirements and measured installer characteristics, not as a head-to-head benchmark against an Electron version, because no such comparison has been run in this repository.

DimensionPublished figureWhat it describes
Runtime.NET 8, bundledNo separate framework install required; the runtime ships in the installer.
Installer size~58 MBApproximate single-file x64 installer; the release manifest carries the exact byte count.
Disk space400 MBStated hard disk requirement for installation.
Memory (idle)250 MBPublished RAM requirement for the idle resident host.
OSWindows 10 build 19041+ / Windows 11, x64Windows-only by design; no cross-platform claim is made.

The 250 MB idle figure is the number to read alongside the residency argument. A tray host is expected to be running constantly, so the team set an explicit idle budget rather than treating resident memory as free. The honest-baselines habit matters here too: the download page marks not-yet-released builds distinctly and warns that pre-release links may be inactive, so the published requirements describe a build that can actually be downloaded and inspected.

What these numbers deliberately do not do is claim a measured victory over Electron. There is no Electron build of TrayTool in the repository, no captured memory trace of one, and no controlled comparison of cold-start time. A separate performance-budget note is queued to produce real RAM, CPU, and cold-start measurements, and until that work exists this page makes only the structural argument above. Putting a specific Electron number here without measuring it would be exactly the kind of unverifiable claim the project refuses to ship.

What we gave up to go native

Choosing WPF is not free, and a note that listed only benefits would be marketing. There are real costs, and they are accepted because they align with a Windows-only tray product rather than despite them.

  • No cross-platform path. WPF runs on Windows. A macOS or Linux version is not a recompile away; it would mean a different UI framework or a different architecture entirely. The product is explicit about being Windows 10/11 x64 and does not imply otherwise.
  • A specialised skill set. The codebase is 234,980 lines of C# across 22 modules. Maintaining it needs .NET and Windows desktop expertise, whereas an Electron team can lean on broadly available web skills. The trade is deeper platform fit in exchange for a narrower hiring pool.
  • Direct interop instead of a web UI toolkit. Reaching the notification area means using shell interop rather than dropping in a familiar web component library. Rich, web-style interfaces inside the optional main window take more deliberate work than they would in HTML and CSS.
  • Platform-specific lifecycle details. The explicit shutdown mode, hidden-window handling, and single-instance guard are things the team has to own and test on Windows directly. A web-wrapper framework abstracts some of this, at the cost of carrying the wrapper.

These costs are tolerable because the product's scope is deliberately narrow: a Windows resident tray host with a permission-gated command plane. Widen the scope to cross-platform or to a content-first interface and the balance of this decision would shift, and a future note should say so rather than treating WPF as a universal answer.

Where the current build actually stands

To keep this grounded rather than aspirational, here is what the audited 2026-09-07 repository snapshot actually contains and what it does not. The host exists: a native C# WPF tray application of 234,980 lines across 22 modules and 512 files, exposing 71 commands across 15 domains through six built-in plugins, with a three-tier risk gate on every invocation and an audit log behind it. The .NET 8 runtime is bundled, and the installer and resource figures above are the ones published for it.

What does not exist yet is equally part of the record. Third-party plugins number zero, because runtime loading of external packages and the marketplace are later roadmap phases; the MCP server that would expose the command plane to AI agents is a Phase P2 item, not a built feature; and Editions and marketplace payments remain unbuilt. Nothing in the framework choice changes that roadmap. Native WPF is the foundation these features land on, not evidence that they have already shipped.

The decision, then, is narrow and defensible. For a Windows-only process whose job is to stay resident, present itself through the system tray, and gate direct access to a C# command plane, building once on the operating system's own desktop stack was a better fit than wrapping the whole thing in a bundled browser. The numbers that support that are published and checkable; the comparisons that have not been measured are left unwritten.