diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index ca1674315..274f88dc6 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -54,6 +54,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
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 d36a49538..4bc79ccb3 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 e90582b31..503704046 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -26,6 +26,7 @@ using Key = System.Windows.Input.Key;
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 @@ namespace Flow.Launcher
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 @@ namespace Flow.Launcher
InitializeComponent();
InitializePosition();
+
+ animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
+
DataObject.AddPastingHandler(QueryTextBox, OnPaste);
}
@@ -128,6 +132,8 @@ namespace Flow.Launcher
{
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 4f13724f7..0f692c75b 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 1e886c022..96f80f0c5 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 231e65539..86a25ffb1 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -63,6 +63,9 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.PreviewHotkey):
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
break;
+ case nameof(Settings.SoundVolume):
+ OnPropertyChanged(nameof(SoundEffectVolume));
+ break;
}
};
@@ -631,6 +634,12 @@ namespace Flow.Launcher.ViewModel
set => Settings.UseSound = value;
}
+ public double SoundEffectVolume
+ {
+ get => Settings.SoundVolume;
+ set => Settings.SoundVolume = value;
+ }
+
public bool UseClock
{
get => Settings.UseClock;