Add Windows notification support via native toast fallback#50
Open
Chebaleomkar wants to merge 2 commits into
Open
Add Windows notification support via native toast fallback#50Chebaleomkar wants to merge 2 commits into
Chebaleomkar wants to merge 2 commits into
Conversation
On Windows, /dev/tty fails inside Claude Code's hook runner because stdio is captured. OSC 777 escape sequences never reach Warp's terminal emulator, so notifications silently fail. This adds a Windows-native fallback using PowerShell's Windows.UI.Notifications API: - win-toast.ps1: Sends native Windows toasts branded as Warp (registers dev.warp.Warp AppUserModelId with Warp's icon) - win-notify.sh: Deduplication (mkdir lock, 8s window) + event-type routing with project context in notification title - Patched on-stop.sh, on-notification.sh, on-permission-request.sh to call win-notify.sh after warp-notify.sh - Patched warp-notify.sh to try /dev/tty first, fall back gracefully Zero dependencies — uses built-in Windows 10/11 APIs. macOS/Linux behavior is unchanged. Fixes warpdotdev#48
9a28062 to
9284957
Compare
16 tests covering: - Non-Windows exit (no-op on macOS/Linux) - Windows detection and PowerShell invocation - Deduplication via mkdir lock (8s window) - Event type routing (stop, idle_prompt, permission_request, session_start) - Project name extraction from cwd - Hook script patching verification - warp-notify.sh fallback logic - win-toast.ps1 structure and Warp AppUserModelId Tests use a mock PowerShell to verify behavior without sending actual notifications — safe to run in CI on any platform.
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.
Problem
On Windows, the Warp Claude Code plugin's notifications silently fail. The OSC 777 escape sequences written to
/dev/ttynever reach Warp's terminal emulator because Claude Code's hook runner captures all stdio pipes (stdout for structured JSON responses, stderr for error handling).Hooks fire correctly — verified via debug logging — but the notification never appears on screen.
Fixes #48
Solution
Added a Windows-native fallback that sends toast notifications via PowerShell's
[Windows.UI.Notifications]API when/dev/ttyfails:New files
win-toast.ps1— Sends Windows toast notifications branded as Warp (registersdev.warp.WarpAppUserModelId with Warp's icon)win-notify.sh— Deduplication viamkdirlock (8s window), event-type routing, project context extractionModified files
warp-notify.sh— Try/dev/ttyfirst, exit on success; fall back to stderr otherwiseon-stop.sh— Callwin-notify.shafterwarp-notify.shon-notification.sh— Sameon-permission-request.sh— SameEvent-specific notifications
Key design decisions
win-notify.shexits immediately if$WINDIRis unsetmkdiratomic lock ensures only one toast per 8 secondsdev.warp.Warpwith Warp's icon in Windows registry (HKCU, no admin needed)[ -f "$SCRIPT_DIR/win-notify.sh" ]in hooks, so older plugin versions without the file are unaffectedTesting
Tested on:
All three notification types confirmed working with Warp branding and single-notification deduplication.
Related