Adds Windows sound playback support to the opencode warcraft notifications plugin.#182
Open
tokmac wants to merge 6 commits into
Open
Adds Windows sound playback support to the opencode warcraft notifications plugin.#182tokmac wants to merge 6 commits into
tokmac wants to merge 6 commits into
Conversation
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.
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.
Changes
extractFilenamesplit on/only, breaking faction determination, file existence checks, and toast descriptions on Windows backslash pathspowershell.exe+System.Media.SoundPlayerusing-EncodedCommand(base64 UTF-16LE) for safe path passingSystemSounds.Asteriskwhen a sound file is missing, mirroring the Linux fallback pattern