From 67e5fed179fa2a4ef7781770398f8c3874ffe216 Mon Sep 17 00:00:00 2001 From: David Brett Date: Thu, 7 May 2026 10:41:21 +0200 Subject: [PATCH 1/6] Set AssemblyTitle in SolutionAssemblyInfo The volume mixer uses this value, so this fixes the issue where no named showed for flow there --- SolutionAssemblyInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/SolutionAssemblyInfo.cs b/SolutionAssemblyInfo.cs index 2938bcbbedd..365cfc0d26b 100644 --- a/SolutionAssemblyInfo.cs +++ b/SolutionAssemblyInfo.cs @@ -10,6 +10,7 @@ [assembly: AssemblyDescription("Release build, https://github.com/Flow-Launcher/Flow.Launcher")] #endif +[assembly: AssemblyTitle("Flow Launcher")] [assembly: AssemblyCompany("Flow Launcher")] [assembly: AssemblyProduct("Flow Launcher")] [assembly: AssemblyCopyright("The MIT License (MIT)")] From fae9181bc88ea720805af8ae748b94076df4aec3 Mon Sep 17 00:00:00 2001 From: David Brett Date: Thu, 7 May 2026 11:04:58 +0200 Subject: [PATCH 2/6] Convert UseSound in Settings to an observable property --- .../UserSettings/Settings.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index c44fe2ef1da..fd535f21a6e 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -159,7 +159,19 @@ public string Theme public string ResultSubFontStretch { get; set; } public bool UseGlyphIcons { get; set; } = true; public bool UseAnimation { get; set; } = true; - public bool UseSound { get; set; } = true; + private bool _useSound = true; + public bool UseSound + { + get => _useSound; + set + { + if (_useSound != value) + { + _useSound = value; + OnPropertyChanged(); + } + } + } public double SoundVolume { get; set; } = 50; public bool ShowBadges { get; set; } = false; public bool ShowBadgesGlobalOnly { get; set; } = false; From 8b772b15d0177852b9a38fa139483826be372d1f Mon Sep 17 00:00:00 2001 From: David Brett Date: Thu, 7 May 2026 11:36:41 +0200 Subject: [PATCH 3/6] Observe UseSound and lazily sync sound effect initialization Add SyncSoundEffectsState and observe UseSound changes in MainWindow Only initialize sound effects on startup when Settings.UseSound is enabled. Listen for UseSound changes at runtime and sync the sound player state by initializing or disposing it as needed. --- Flow.Launcher/MainWindow.xaml.cs | 54 ++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 60517db9736..da4a0689259 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -95,7 +95,7 @@ public MainWindow() InitializeComponent(); UpdatePosition(); - InitSoundEffects(); + SyncSoundEffectsState(); RegisterSoundEffectsEvent(); DataObject.AddPastingHandler(QueryTextBox, QueryTextBox_OnPaste); _viewModel.ActualApplicationThemeChanged += ViewModel_ActualApplicationThemeChanged; @@ -328,6 +328,9 @@ private void OnLoaded(object sender, RoutedEventArgs e) case nameof(Settings.ShowAtTopmost): Topmost = _settings.ShowAtTopmost; break; + case nameof(Settings.UseSound): + SyncSoundEffectsState(); + break; } }; @@ -718,6 +721,46 @@ private void SoundPlay() } } + private bool IsSoundEffectsInitialized() + { + lock (_soundLock) + { + return _animationSoundWMP != null || _animationSoundWPF != null; + } + } + + private void DisposeSoundEffects() + { + lock (_soundLock) + { + _animationSoundWMP?.Stop(); + _animationSoundWMP?.Close(); + _animationSoundWMP = null; + + _animationSoundWPF?.Stop(); + _animationSoundWPF?.Dispose(); + _animationSoundWPF = null; + } + } + + private void SyncSoundEffectsState(bool forceReinitializeWhenEnabled = false) + { + if (!_settings.UseSound) + { + if (IsSoundEffectsInitialized()) + { + DisposeSoundEffects(); + } + + return; + } + + if (forceReinitializeWhenEnabled || !IsSoundEffectsInitialized()) + { + InitSoundEffects(); + } + } + private void RegisterSoundEffectsEvent() { // Fix for sound not playing after sleep / hibernate for both modern standby and legacy standby @@ -731,14 +774,14 @@ private void RegisterSoundEffectsEvent() return; } - // We must run InitSoundEffects on UI thread because MediaPlayer is a DispatcherObject + // We must run SyncSoundEffectsState on UI thread because MediaPlayer is a DispatcherObject if (!Application.Current.Dispatcher.CheckAccess()) { - Application.Current.Dispatcher.Invoke(InitSoundEffects); + Application.Current.Dispatcher.Invoke(() => SyncSoundEffectsState(forceReinitializeWhenEnabled: true)); return; } - InitSoundEffects(); + SyncSoundEffectsState(forceReinitializeWhenEnabled: true); }); } catch (Exception e) @@ -1480,8 +1523,7 @@ protected virtual void Dispose(bool disposing) { _hwndSource?.Dispose(); _notifyIcon?.Dispose(); - _animationSoundWMP?.Close(); - _animationSoundWPF?.Dispose(); + DisposeSoundEffects(); _viewModel.ActualApplicationThemeChanged -= ViewModel_ActualApplicationThemeChanged; UnregisterSoundEffectsEvent(); } From 298f45b06f803ae12eccb0113ecfdc014c6ff2a1 Mon Sep 17 00:00:00 2001 From: David Brett Date: Thu, 7 May 2026 11:43:41 +0200 Subject: [PATCH 4/6] Add null checks to SoundPlay --- Flow.Launcher/MainWindow.xaml.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index da4a0689259..7399b03b2a8 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -710,12 +710,20 @@ private void SoundPlay() { if (_settings.WMPInstalled) { + if (_animationSoundWMP == null){ + return; + } + _animationSoundWMP.Position = TimeSpan.Zero; _animationSoundWMP.Volume = _settings.SoundVolume / 100.0; _animationSoundWMP.Play(); } else { + if (_animationSoundWPF == null){ + return; + } + _animationSoundWPF.Play(); } } From 52370d7db7b5609dae61e5c9b30a9df87b420744 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 7 May 2026 20:35:43 +0800 Subject: [PATCH 5/6] Code format --- Flow.Launcher/MainWindow.xaml.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 7399b03b2a8..b1580e9d0c6 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -710,7 +710,8 @@ private void SoundPlay() { if (_settings.WMPInstalled) { - if (_animationSoundWMP == null){ + if (_animationSoundWMP == null) + { return; } @@ -720,7 +721,8 @@ private void SoundPlay() } else { - if (_animationSoundWPF == null){ + if (_animationSoundWPF == null) + { return; } From c7447ea36af08efa986f262406f6330cbf18c4b5 Mon Sep 17 00:00:00 2001 From: David Brett Date: Thu, 7 May 2026 14:46:03 +0200 Subject: [PATCH 6/6] UnregisterSoundEffectsEvent before DisposeSoundEffects in MainWindow Dispose --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index b1580e9d0c6..70273d616c3 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1533,9 +1533,9 @@ protected virtual void Dispose(bool disposing) { _hwndSource?.Dispose(); _notifyIcon?.Dispose(); + UnregisterSoundEffectsEvent(); DisposeSoundEffects(); _viewModel.ActualApplicationThemeChanged -= ViewModel_ActualApplicationThemeChanged; - UnregisterSoundEffectsEvent(); } _disposed = true;