diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 5f9082fe9..d0351af51 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -37,6 +37,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string ResultFontStretch { get; set; } public bool UseGlyphIcons { get; set; } = true; + public bool UseAnimation { get; set; } = true; + public bool UseSound { get; set; } = false; + /// /// when false Alphabet static service will always return empty results diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1cb203515..9721ad869 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -80,6 +80,10 @@ Fail to load theme {0}, fallback to default theme Theme Folder Open Theme Folder + Sound Effect + Play a small sound when window open. + Animation + Use Animation in UI. Hotkey diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index db38f0fad..2d8e2f822 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -238,44 +238,47 @@ namespace Flow.Launcher public void WindowAnimator() { - if (_animating) - return; + if (_settings.UseAnimation) + { + if (_animating) + return; - _animating = true; - UpdatePosition(); - Storyboard sb = new Storyboard(); - var da = new DoubleAnimation - { - From = 0, - To = 1, - Duration = TimeSpan.FromSeconds(0.2), - FillBehavior = FillBehavior.Stop - }; + _animating = true; + UpdatePosition(); + Storyboard sb = new Storyboard(); + var da = new DoubleAnimation + { + From = 0, + To = 1, + Duration = TimeSpan.FromSeconds(0.2), + FillBehavior = FillBehavior.Stop + }; - var da2 = new DoubleAnimation - { - From = Top + 8, - To = Top, - Duration = TimeSpan.FromSeconds(0.2), - FillBehavior = FillBehavior.Stop - }; + var da2 = new DoubleAnimation + { + From = Top + 8, + To = Top, + Duration = TimeSpan.FromSeconds(0.2), + FillBehavior = FillBehavior.Stop + }; - var da3 = new DoubleAnimation - { - From = Left, - To = Left, - Duration = TimeSpan.FromSeconds(0.1), - FillBehavior = FillBehavior.Stop - }; - Storyboard.SetTarget(da, this); - Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty)); - Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty)); - Storyboard.SetTargetProperty(da3, new PropertyPath(Window.LeftProperty)); - sb.Children.Add(da); - sb.Children.Add(da2); - sb.Children.Add(da3); - sb.Completed += (_, _) => _animating = false; - sb.Begin(FlowMainWindow); + var da3 = new DoubleAnimation + { + From = Left, + To = Left, + Duration = TimeSpan.FromSeconds(0.1), + FillBehavior = FillBehavior.Stop + }; + Storyboard.SetTarget(da, this); + Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty)); + Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty)); + Storyboard.SetTargetProperty(da3, new PropertyPath(Window.LeftProperty)); + sb.Children.Add(da); + sb.Children.Add(da2); + sb.Children.Add(da3); + sb.Completed += (_, _) => _animating = false; + sb.Begin(FlowMainWindow); + } } diff --git a/Flow.Launcher/Resources/open.wav b/Flow.Launcher/Resources/open.wav new file mode 100644 index 000000000..c3e061997 Binary files /dev/null and b/Flow.Launcher/Resources/open.wav differ diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index e69b26f63..e49465176 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1388,11 +1388,15 @@ TextAlignment="left" /> - - + + @@ -1470,26 +1474,29 @@ - - + + - + @@ -1749,6 +1756,70 @@ + + + + + + + + + + + +  + + + + + + + + + + + + +  + + + + + + diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 4509d1fce..6e1befeaf 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; using System.Windows; +using System.Windows.Media; using System.Windows.Input; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; @@ -712,6 +713,12 @@ namespace Flow.Launcher.ViewModel { if (WinToggleStatus != true) { + if (_settings.UseSound) + { + MediaPlayer media = new MediaPlayer(); + media.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); + media.Play(); + } MainWindowVisibility = Visibility.Visible; WinToggleStatus = true; ((MainWindow)Application.Current.MainWindow).WindowAnimator(); diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 4947ca380..773c4733c 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -328,6 +328,18 @@ namespace Flow.Launcher.ViewModel set => Settings.UseGlyphIcons = value; } + public bool UseAnimation + { + get => Settings.UseAnimation; + set => Settings.UseAnimation = value; + } + + public bool UseSound + { + get => Settings.UseSound; + set => Settings.UseSound = value; + } + public Brush PreviewBackground { get