Standalone Notifier IPC Subsystem
LocalTelemetry.Notifier is a standalone, lightweight WinForms executable (LocalTelemetry.Notifier.exe) targeting .NET 10 Windows x64, dedicated to rendering non-blocking desktop toast alert windows.
Why a Standalone Process?
Rendering alert windows with slide-in animations and auto-dismiss timers inside the main application process carries two key risks:
- Focus Stealing: Window activation during full-screen gaming or video playback could cause games to lose keyboard focus or minimize to desktop
- UI Thread Blocking: Animation loops on the main UI thread could delay telemetry sensor polling ticks
By spinning up LocalTelemetry.Notifier.exe as a secondary process, notifications display smoothly without stealing foreground focus or blocking hardware monitoring threads.
Named Pipe IPC Communication
LocalTelemetry.App launches LocalTelemetry.Notifier.exe passing its Parent Process ID (PID) as args[0]. Inter-process communication takes place over an asynchronous Windows Named Pipe (LocalTelemetryNotifier).
On-Demand Process Lifecycle
To conserve system resources, LocalTelemetry.Notifier.exe is not kept running unconditionally. App.xaml.cs dynamically controls the process lifecycle:
EnsureNotifierLaunched(): Invoked on startup or when the user enables threshold alerts with toast notifications in Settings. Launches the executable with the current process ID asargs[0].EnsureNotifierStopped(): Invoked when alerts or toast notifications are disabled in Settings, or when LocalTelemetry is closing. Dispatches aShutdownIPC message over the named pipe and waits up to 2 seconds for a clean shutdown before terminating the process.
JSON Message Contract (NotificationMessage)
NotificationClient.cs serializes messages over the pipe in UTF-8 JSON Lines format:
{
"Action": "ShowToast",
"Title": "CPU Temperature Warning",
"Body": "CPU reached 88°C (Limit: 85°C)",
"Tag": "cpu_temp"
}private sealed record NotificationMessage
{
public string Action { get; set; } = string.Empty;
public string? Title { get; set; }
public string? Body { get; set; }
public string? Tag { get; set; }
}Command Actions
ShowToast: TriggersToastFormrendering on screen withTitleandBodyShutdown: Gracefully cancelsCancellationTokenSourceand closesHiddenForm
Hidden Message Pump (HiddenForm)
Inside Program.cs, an invisible HiddenForm provides a WinForms message pump:
- Hidden from Alt+Tab via
WS_EX_TOOLWINDOW(0x00000080) extended window style ShowInTaskbar = false,WindowState = Minimized,Opacity = 0- Receives pipe messages on a background thread (
RunPipeServerAsync) and dispatches toast creation to the UI thread viahiddenForm.BeginInvoke(...)
Toast Window Rendering & Animation
Implemented in ToastForm.cs, the window renders a custom dark alert popup:
- Dimensions:
320pxwidth ×90pxheight. - Appearance: Dark background (
Color.FromArgb(32, 32, 32)), rounded corners (CornerRadius = 8viaGraphicsPath), border pen (Color.FromArgb(60, 60, 60)). - Audio Cue: Plays system exclamation sound (
SystemSounds.Exclamation.Play()). - Ease-Out Slide-In Animation:
OnLoadanimates the window position from below the screen working area using a cubic ease-out curve (1.0 - Math.Pow(1.0 - t, 3)) over300ms. - Auto-Dismiss: A
System.Windows.Forms.Timerautomatically closes the toast window after5000ms.
Parent Process Monitoring & Auto-Exit
When LocalTelemetry.Notifier.exe receives parentPid as args[0]:
- Launches a background worker task:
Process.GetProcessById(parentPid).WaitForExitAsync(). - When the parent
LocalTelemetry.exeprocess exits, the notifier process automatically logs exit and shuts down cleanly.
Notifier Diagnostic Logging
Implemented in NotifierLog.cs, LocalTelemetry.Notifier records its operational lifecycle, named pipe connections, and toast animations directly to lt_notifier.log:
- File Location: Uses the identical directory resolution rule as
AppSettings(located in%LOCALAPPDATA%\LocalTelemetry\lt_notifier.login standard mode, or alongside the executable in portable mode). - Clean Shutdown:
NotifierLog.Shutdown()flushes buffered log entries to disk when the message pump exits.