Skip to content

Adds Windows sound playback support to the opencode warcraft notifications plugin.#182

Open
tokmac wants to merge 6 commits into
pantheon-org:mainfrom
tokmac:feat/windows-sound-playback
Open

Adds Windows sound playback support to the opencode warcraft notifications plugin.#182
tokmac wants to merge 6 commits into
pantheon-org:mainfrom
tokmac:feat/windows-sound-playback

Conversation

@tokmac

@tokmac tokmac commented Jun 23, 2026

Copy link
Copy Markdown

Changes

  • fix: handle backslash path separators in filename extractionextractFilename split on / only, breaking faction determination, file existence checks, and toast descriptions on Windows backslash paths
  • feat: add Windows primary sound playback — plays WAV files via powershell.exe + System.Media.SoundPlayer using -EncodedCommand (base64 UTF-16LE) for safe path passing
  • fix: suppress powershell progress stream — prevents CLIXML "Preparing modules for first use" output from leaking into the TUI input field
  • feat: add Windows fallback sound — plays SystemSounds.Asterisk when a sound file is missing, mirroring the Linux fallback pattern
  • docs: update README — Windows now shows as full support with mechanism described

extractFilename split on forward slashes only, returning the full path
on Windows where path.join produces backslashes. This broke faction
determination, sound existence checks, and toast descriptions on
Windows. Split on both / and \ separators now.

Updates the existing unit test that asserted the broken behavior.
Replace the Windows playback stub with a real implementation using
powershell.exe and System.Media.SoundPlayer. The PowerShell script is
encoded as UTF-16LE base64 and passed via -EncodedCommand to avoid
quoting issues with Windows backslash paths.

Updates the behavior test to assert Windows now has a powershell.exe
command instead of asserting no command.
PowerShell emits a CLIXML progress object ('Preparing modules for first
use') to stdout on first run, which Bun's shell echoes to the terminal
and the TUI picks up as input text. Two fixes:

- Set Continue = 'SilentlyContinue' in the PowerShell script
  to suppress the progress stream
- Chain .quiet() on the shell call to prevent any stdout from leaking
Replace the fallback stub with [System.Media.SystemSounds]::Asterisk
via powershell.exe -EncodedCommand, mirroring the Linux fallback
pattern (canberra-gtk-play --id=message). The existing 'Sound file
not found' toast continues to show alongside the fallback sound.
Replace all partial support and planned language with full support
messaging. Updates the Cross-Platform feature line, Platform Support
table, How It Works section, and Windows Support Status subsection.
Some bundled WAV files are corrupted (under 44 bytes). SoundPlayer
throws 'not a valid wave file', which bubbled up and dumped the error
into the TUI input. Catch the failure inline and fall back to
SystemSounds.Asterisk instead of letting the error reach the outer
catch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants