diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index ca167431564..274f88dc674 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -54,6 +54,8 @@ public string Theme
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public bool UseSound { get; set; } = true;
+ public double SoundVolume { get; set; } = 50;
+
public bool UseClock { get; set; } = true;
public bool UseDate { get; set; } = false;
public string TimeFormat { get; set; } = "hh:mm tt";
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index d36a49538ee..4bc79ccb398 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -156,6 +156,8 @@
Dark
Sound Effect
Play a small sound when the search window opens
+ Sound Effect Volume
+ Adjust the volume of the sound effect
Animation
Use Animation in UI
Animation Speed
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index e90582b3166..50370404661 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -26,6 +26,7 @@
using System.Media;
using static Flow.Launcher.ViewModel.SettingWindowViewModel;
using DataObject = System.Windows.DataObject;
+using System.Windows.Media;
namespace Flow.Launcher
{
@@ -40,7 +41,7 @@ public partial class MainWindow
private ContextMenu contextMenu;
private MainViewModel _viewModel;
private bool _animating;
- SoundPlayer animationSound = new SoundPlayer(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav");
+ MediaPlayer animationSound = new MediaPlayer();
#endregion
@@ -52,6 +53,9 @@ public MainWindow(Settings settings, MainViewModel mainVM)
InitializeComponent();
InitializePosition();
+
+ animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
+
DataObject.AddPastingHandler(QueryTextBox, OnPaste);
}
@@ -128,6 +132,8 @@ private void OnLoaded(object sender, RoutedEventArgs _)
{
if (_settings.UseSound)
{
+ animationSound.Position = TimeSpan.Zero;
+ animationSound.Volume = _settings.SoundVolume / 100.0;
animationSound.Play();
}
UpdatePosition();
diff --git a/Flow.Launcher/Resources/open.wav b/Flow.Launcher/Resources/open.wav
index 4f13724f709..0f692c75b37 100644
Binary files a/Flow.Launcher/Resources/open.wav and b/Flow.Launcher/Resources/open.wav differ
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index 1e886c022b2..96f80f0c5c6 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -2474,27 +2474,81 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index 231e65539ef..86a25ffb118 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -63,6 +63,9 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
case nameof(Settings.PreviewHotkey):
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
break;
+ case nameof(Settings.SoundVolume):
+ OnPropertyChanged(nameof(SoundEffectVolume));
+ break;
}
};
@@ -631,6 +634,12 @@ public bool UseSound
set => Settings.UseSound = value;
}
+ public double SoundEffectVolume
+ {
+ get => Settings.SoundVolume;
+ set => Settings.SoundVolume = value;
+ }
+
public bool UseClock
{
get => Settings.UseClock;