Skip to content

Add audio feedback using custom .wav files - #49412

Open
class-Avirup wants to merge 3 commits into
microsoft:mainfrom
class-Avirup:add_audio_feedback_customsounds
Open

Add audio feedback using custom .wav files#49412
class-Avirup wants to merge 3 commits into
microsoft:mainfrom
class-Avirup:add_audio_feedback_customsounds

Conversation

@class-Avirup

@class-Avirup class-Avirup commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Adds audible feedback to PowerToys Run: a sound plays when the Run window opens and/or closes. Replaces the earlier system-sound dropdown (Beep/Asterisk/Exclamation/Hand/Question) design with a simpler toggle-based UI and two custom, purpose-recorded .wav files instead of relying on Windows system sounds.

  • New Settings UI: a single "Audible feedback" toggle, with two dependent sub-toggles ("Opening Sound" / "Closing Sound") that are disabled unless the parent toggle is on.
  • Two new bundled audio assets (open.wav, close.wav) replace the previous Windows system-sound based approach.
  • Playback uses winmm.dll's PlaySound API, invoked from MainWindow.xaml.cs on OnVisibilityChanged.

PR Checklist

  • Closes: #11225
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Settings model (PowerLauncherProperties.cs):

  • Added three new boolean properties: EnableAudibleFeedback, EnableOpeningSound, EnableClosingSound, each defaulting to false.
  • Removed the earlier OpeningSound / ClosingSound string properties and the associated SoundOption dropdown model, since the UI no longer offers a choice of system sounds.

ViewModel (PowerLauncherViewModel.cs):

  • Added matching wrapper properties (EnableAudibleFeedback, EnableOpeningSound, EnableClosingSound) that propagate changes to PowerLauncherProperties and trigger UpdateSettings()/IPC sync, following the existing pattern used by other boolean toggles in this file.

Settings UI (resources.resw + XAML):

  • Replaced the dropdown-based sound picker UI with a SettingsExpander containing a top-level toggle and two dependent SettingsCard toggles, each IsEnabled-bound to the parent toggle.
  • Added new resource strings for the expander header and both sub-toggle cards; removed now-unused strings from the old dropdown design (PowerLauncher_Sound_None/Beep/Asterisk/Exclamation/Hand/Question, preview-button tooltips).

Runtime playback (MainWindow.xaml.cs, PowerLauncher):

  • Added a PlaySound P/Invoke against winmm.dll.
  • PlayAudibleFeedback(bool isOpening) checks EnableAudibleFeedback and the relevant sub-toggle, then plays open.wav or close.wav from a Sounds/ folder next to the executable (resolved via AppContext.BaseDirectory), guarded by a File.Exists check with logging on failure.
  • Hooked into OnVisibilityChanged for both the show and hide paths.
  • Added a _loadedAtLeastOnce guard so the opening sound doesn't fire on the very first cold-start invocation.

Audio assets:

  • Sounds/open.wav and Sounds/close.wav, sourced from freesound.org, added to PowerLauncher.csproj with CopyToOutputDirectory = PreserveNewest.
  • License note for reviewers: these are third-party audio assets. License/attribution details: [fill in — exact freesound.org license (e.g. CC0 1.0) and author credit per file]. Please confirm license compatibility with PowerToys' MIT license before merge, and add attribution to NOTICE/third-party-notices if the license requires it.
  • Opening Sound-Click here
  • Closing Sound-Click here

Tests (Settings.UI.UnitTests):

  • PowerLauncherViewModelTest.SoundSettingsShouldUpdateSettings — verifies the three new toggle properties propagate correctly to the underlying settings and fire the expected number of IPC callbacks.
  • Extended OriginalFilesModificationTest to assert the new properties default to false when loading settings files from versions prior to this feature (backward compatibility).
  • SetSettingCommandTests — added DataRow entries for EnableAudibleFeedback / EnableOpeningSound / EnableClosingSound covering the --settings CLI path.

Validation Steps Performed

  • Built PowerLauncher.csproj and PowerToys.Settings.csproj individually; both succeed.
  • Ran the full solution build (PowerToys.slnx) end-to-end successfully after resolving unrelated pre-existing environment issues (NuGet package source mapping for public runtime packages, classic packages.config restore for native C++ projects).
  • Ran unit tests in Settings.UI.UnitTests covering the new settings properties; all pass.
  • Manually launched PowerToys Run via the configured hotkey with all four toggle combinations (feedback off; feedback on with only opening; only closing; both) and confirmed sound plays only in the expected cases.
  • Verified settings persist correctly across a PowerToys restart by inspecting settings.json.
  • Verified toggling "Audible feedback" off correctly disables (and visually greys out) both sub-toggles in the Settings UI.
  • Confirmed no sound plays, and no exception is thrown/logged, when a referenced .wav file is temporarily removed from the output directory (fallback logging path).

Working ScreenRecording: Click here
Parent PR :#48911

@class-Avirup
class-Avirup requested a review from a team as a code owner July 20, 2026 05:00
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added Area-Localization issues regarding to Localization the application Product-PowerToys Run Improved app launch PT Run (Win+R) Window Product-Settings The standalone PowerToys Settings application labels Jul 20, 2026
Comment thread nuget.config
@moooyo

moooyo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@moooyo

moooyo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

still broken. Please fix xaml style issue. Run xaml script locally.

@class-Avirup
class-Avirup force-pushed the add_audio_feedback_customsounds branch from 99dc43c to 7da8555 Compare July 25, 2026 06:58
@class-Avirup

Copy link
Copy Markdown
Contributor Author

@moooyo please rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Localization issues regarding to Localization the application Product-PowerToys Run Improved app launch PT Run (Win+R) Window Product-Settings The standalone PowerToys Settings application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants