feat: smart notifications — built-in throttling, auto app logo detection, and Claude Code readiness#291
Open
AdhamHossamm wants to merge 2 commits into
Conversation
…tection, and Claude Code ready Toast notifications just got intelligent. Two features that make BurntToast aware of its context and respectful of your attention: 1. Notification Throttling (CooldownSeconds): Built-in spam prevention via per-identifier lock files in %TEMP%. Rapid-fire scripts, CI hooks, and automation loops no longer flood your screen — only the first toast within the cooldown window fires. Uses .NET I/O to bypass WhatIf scope so state persists during dry runs. 2. Auto App Logo Detection (AutoAppLogo + AppLogoMap): BurntToast now knows who called it. Walks the process tree to find the parent terminal or IDE, extracts its icon, and uses it as the toast logo. AppLogoMap lets you pin custom icons to specific callers — e.g., mapping 'node' to Claude's logo so Claude Code notifications look native. Born from real-world Claude Code hook integration where rapid subagent completions were spamming toasts and every notification looked the same regardless of which app triggered it. 18 new Pester v5 tests. Full suite: 98/98 passing, zero regressions. Co-Authored-By: Tawaar Technologies <info@tawaar.net>
Stress tests covering: - 20-call rapid-fire loop (only 1 toast fires) - Cooldown expiry via backdated lock file - Zero and negative CooldownSeconds - Special characters in UniqueIdentifier - Lock file integrity and ISO 8601 timestamp validation - Concurrent identifier isolation (A+B throttled, C fires) - Nonexistent icon path graceful fallback - Icon cache reuse and PNG magic byte validation - Empty and multi-entry AppLogoMap - XML well-formedness with auto-detected icon - Combined throttle + AutoAppLogo interaction Full suite: 113/113 passing. Co-Authored-By: Tawaar Technologies <info@tawaar.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BurntToast notifications just got context-aware. Two features that make toasts smarter about who triggered them and when to stay quiet:
Notification Throttling (
-CooldownSeconds): Built-in spam prevention. A new parameter on bothSubmit-BTNotificationandNew-BurntToastNotificationthat suppresses duplicate toasts within a configurable time window. EachUniqueIdentifiergets its own independent cooldown tracked via lock files in%TEMP%\BurntToast-Throttle. Uses .NET I/O (System.IO.File) instead of PowerShell cmdlets so throttle state persists correctly even under-WhatIf.Auto App Logo Detection (
-AutoAppLogo+-AppLogoMap): BurntToast now knows who called it. A new switch onNew-BurntToastNotificationthat walks the process tree to find the first ancestor with a visible window (your terminal, IDE, or app shell), extracts its executable icon viaSystem.Drawing, and caches it in%TEMP%\BurntToast-IconCache. The-AppLogoMaphashtable lets you pin custom icons to specific process names — for example,@{ 'node' = 'C:\icons\claude.ico' }gives Claude Code its own branded notifications.Motivation
Born from real-world Claude Code integration where hook-driven toast notifications had two problems:
These features solve both at the library level so any BurntToast consumer benefits — not just our use case.
Changes
src/Public/Submit-BTNotification.ps1-CooldownSecondsparam with lock file throttle logicsrc/Public/New-BurntToastNotification.ps1-CooldownSecondspassthrough,-AutoAppLogoswitch,-AppLogoMaphashtable, mutual exclusion with-AppLogosrc/Private/Get-BTCallerAppIcon.ps1Tests/Throttle.Tests.ps1Tests/Get-BTCallerAppIcon.Tests.ps1Tests/Advanced-Throttle.Tests.ps1Test plan