Data Monitor
A Windows desktop app that puts live network speed in the taskbar and turns Windows usage history into answers — without an account, a server, or telemetry.
| Role | Desktop application design and implementation, native Windows integration, and product website |
| Stack | Electron 45, JavaScript, Node.js, PowerShell 5.1, WinRT networking APIs, Win32 through koffi, HTML and CSS |
| Scope | Taskbar readout, hover summary, usage dashboard, local preferences, Windows packaging, and download website |
| Status | v0.1 desktop app; installer and portable Windows builds |
| Repository | github.com/avesh-pathak/datamonitor |
| Product website | datamonitor-engine.vercel.app — showcase and downloads, not a browser-based network monitor |
The short version
Data Monitor answers two different questions: how fast is my connection right now? and where did my data go? The first belongs in a glanceable taskbar readout. The second needs history, app attribution, and a dashboard that opens only when asked.
The application runs locally on Windows 11. A long-lived PowerShell sampler reads adapter byte counters once a second. Separate WinRT queries retrieve Windows' existing network-usage records. Electron coordinates three small HTML surfaces, and native Win32 calls keep the readout aligned with the taskbar.
The hardest part was not drawing a chart. It was making a desktop overlay behave like part of Windows without embedding it inside Explorer, stealing focus, or floating over fullscreen work.

A capture of the desktop application. The values illustrate one machine's usage, not a performance benchmark.
The problem: speed is not accounting
A speedometer can show a busy connection without explaining which application consumed the bandwidth. A historical total can explain yesterday without showing whether a download is saturating the connection now. Combining the two into one constantly open window makes a background utility demand too much attention.
The design separates attention into three levels:
| Surface | Question | Interaction |
|---|---|---|
| Taskbar readout | What is happening now? | Download/upload speed, or today's total, without opening a window |
| Hover summary | Is this worth investigating? | Today's total, down/up split, and top apps |
| Dashboard | Where did the data go? | Daily history, app ranking and drill-down, hourly patterns, forecast, and optional cap |
The tray menu handles themes, readout modes, pause, and quit. Ctrl+Alt+D opens the dashboard. The widget and hover window are non-focusable; the dashboard intentionally takes focus when opened.
Architecture: two measurement paths, one desktop shell
The live path never waits for a history query. The history path never pretends that a current rate can reconstruct past application usage. There is no application backend or cloud database in either path.
Live speed: derive a rate, do not display a counter
sampler.ps1 streams a timestamp plus cumulative received and sent bytes. sampler.js buffers stdout until a complete line arrives, validates its three numeric fields, and derives bytes per second from elapsed time:
const seconds = (ms - last.ms) / 1000;
const reset = rx < last.rx || tx < last.tx;
const downRate = reset ? 0 : (rx - last.rx) / seconds;
const upRate = reset ? 0 : (tx - last.tx) / seconds;
A reconnect can reset an adapter's counters. Treating that as ordinary subtraction would produce a negative rate. Here it contributes a zero raw rate and establishes a new baseline. Samples less than or equal to 0.2 seconds apart are not used to calculate a rate.
An exponential moving average weights the previous rate by 0.45 and the new rate by 0.55. This trades a little responsiveness for a calmer readout at the roughly one-second sampling cadence. Formatting converts bytes per second into bits per second, with adaptive Kbps/Mbps units.
One long-lived child process avoids launching PowerShell on every tick. It is still a pragmatic first implementation, not a claim that Electron plus PowerShell has the footprint of a native utility.
History: reuse what Windows already records
usage.ps1 selects the internet connection profile, falling back to another connected profile. It reads daily and hourly buckets through GetNetworkUsageAsync, and per-app totals through GetAttributedNetworkUsageAsync, without requiring an elevated collector.
The query window begins 58 days before today. That is a requested lookback, not an independently maintained 58-day database or a guarantee that every machine has complete records. Bucket dates are reconstructed from the query anchor and bucket index.
The Node wrapper caches usage responses for 30 seconds, keyed by the requested app range. A 30-second timeout terminates a stuck usage query and returns an unavailable result instead of leaving the dashboard waiting forever.
App drill-down is a separate, more expensive operation: appdays.ps1 walks the requested dates and sums attributed records matching the selected app ID. The main process caches those day series for five minutes. Keeping that work on demand avoids paying its cost every time the widget updates.
The central Windows decision: an overlay, not an embedded child
Windows 11's taskbar is not an ordinary container for arbitrary child windows. The project's architecture notes record a probe on build 26300: a magenta test window painted normally at the top level but disappeared when parented into Shell_TrayWnd, despite reporting itself visible. The taskbar's XAML composition made traditional embedding unsuitable.
The implementation instead creates a 210 × 34 DIP transparent, frameless, topmost window and positions it over the taskbar. It is not an Explorer plugin and does not inject code into the shell.
That decision creates several responsibilities:
- Placement:
koffibindsFindWindowW,FindWindowExW, andGetWindowRectto locate the taskbar, Start button, and notification area. The widget prefers the empty band left of a centered Start button, with a notification-area fallback. - DPI: Win32 geometry arrives in physical pixels. The main process uses Electron's display scale factor to convert the final bounds back into device-independent coordinates.
- Visibility: geometry detects an auto-hidden taskbar;
SHQueryUserNotificationStatesupplies a second signal for fullscreen, presentation, and other interruption-sensitive states. Geometry alone cannot tell whether a normally positioned taskbar is actually visible. - Stacking: a 150 ms positioning loop follows the bar. While visible, the overlay calls
moveTop()at roughly 500 ms intervals because Explorer can raise its own topmost window again. - Focus: the widget uses
focusable: false,skipTaskbar: true, andshowInactive(). Reading the network rate should never interrupt typing in another application.
The readout hides when the taskbar is hidden or a relevant fullscreen state is reported. Hiding is not pausing collection: stopping and restarting the live sampler is a separate tray action.
Making the dashboard useful without inventing precision
The dashboard offers last-seven-days, this-week, last-30-days, and month views. Daily bars expose a received/sent split on hover. App rows are grouped by attribution identity, given readable executable names, and can be searched, renamed, or hidden through local preferences.
The weekday-by-hour heatmap folds the historical hourly buckets into a 7 × 24 grid. It answers a different question from the daily chart: not just which day was busy, but whether usage clusters around a recurring hour.
The forecast is deliberately simple:
daily average = bytes in the selected day buckets / number of buckets
month-end run rate = daily average × days in the current month
It is a run-rate estimate, not a learned prediction or a billing guarantee. The optional monthly cap adds a progress indicator rather than an alerting service.
There are also boundaries worth keeping explicit:
- Live rates come from adapter counters; historical totals and app attribution come from Windows' usage store. They are different measurements, not numbers the UI should force into equality.
- Per-app figures are historical aggregates, not live per-process bandwidth.
- Attribution can contain unnamed or system traffic. The naming fallback labels blank identities as
System / unattributed; it does not manufacture an app owner for those bytes. - If history is unavailable, the dashboard displays an unavailable state while the separate live-speed path can continue.
A desktop utility with a narrow renderer boundary
All three windows load local HTML. Their webPreferences enable contextIsolation and sandbox, and disable nodeIntegration. A preload bridge exposes named operations for samples, history requests, settings, hover events, and dashboard opening rather than giving the renderer unrestricted Node.js access.
The main process owns window lifecycle and preferences. Theme choices flow through Electron's nativeTheme, so the taskbar widget, dashboard, and popover share light, dark, or system behavior. Aliases, ignored apps, cap, and readout preferences are persisted in the application's local settings.json.
The hover interaction also has an asynchronous edge case: the user can leave before a history query finishes. A monotonically increasing token invalidates the pending result, preventing a late response from reopening a dismissed popover.
The application code has no account system, analytics SDK, sync endpoint, or telemetry backend. This privacy boundary belongs to the desktop utility; the public download website is a separate web application. Electron may maintain its own runtime files, so the settings file is the app's preference store, not a claim that the entire runtime writes nothing else.
Shipping the app, not just a screenshot
electron-builder packages an NSIS installer and a portable executable. PowerShell scripts are explicitly unpacked from ASAR, and the runtime resolves their paths to app.asar.unpacked before spawning them. Without that packaging detail, a script path that works from source would stop working inside the installed app.
The companion website uses Next.js, React, TypeScript, and Tailwind. It explains the three surfaces, displays real captures, and provides download and setup links. It is a distribution surface for a desktop product—not the place where local adapter counters are collected.
Trade-offs and what comes next
| Current decision | Benefit | Limit / next step |
|---|---|---|
| PowerShell adapter sampler | Straightforward Windows integration, no elevated collector | Extra process overhead; a native collector is a future direction |
| Windows-owned history | Useful existing records without building a storage service | Availability and retention depend on Windows and the selected connection profile |
| Unelevated attribution queries | No admin requirement for the measurement path | No live per-process accounting; an elevated ETW helper is planned, not shipped here |
| In-memory query caches | Avoid repeated expensive history reads | No independently persisted usage database; SQLite retention and rollups remain future work |
| Topmost taskbar overlay | Avoids the failed XAML child-window approach | Requires polling and stacking management; placement is primary-display-oriented |
| Plain HTML/CSS/JS renderers | No frontend framework or bundler in the desktop surfaces | UI state and event lifecycles are maintained directly |
The delivered result is a Windows desktop utility with live taskbar speed, a hover summary, historical analytics, local preferences, and packaged builds. There is no usage-growth or CPU benchmark claimed here. The engineering result is the integration itself: two distinct measurement paths, a taskbar surface that respects focus and visibility, and an explicit boundary between a useful v0.1 and the collector that could come next.