diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 10a1e46d1..ca1674315 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -53,7 +53,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public string ResultFontStretch { get; set; }
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
- public int AnimationLength { get; set; } = 360;
public bool UseSound { get; set; } = true;
public bool UseClock { get; set; } = true;
public bool UseDate { get; set; } = false;
@@ -255,6 +254,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
[JsonConverter(typeof(JsonStringEnumConverter))]
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;
+ [JsonConverter(typeof(JsonStringEnumConverter))]
+ public AnimationSpeeds AnimationSpeed { get; set; } = AnimationSpeeds.Medium;
+ public int CustomAnimationLength { get; set; } = 360;
+
// This needs to be loaded last by staying at the bottom
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
@@ -291,4 +294,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings
RightTop,
Custom
}
+
+ public enum AnimationSpeeds
+ {
+ Slow,
+ Medium,
+ Fast,
+ Custom
+ }
}
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index e69d9dcd8..bee595772 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -157,8 +157,12 @@
Play a small sound when the search window opens
Animation
Use Animation in UI
- Animation Length (ms)
- The length of the UI animation in milliseconds
+ Animation Speed
+ The speed of the UI animation
+ Slow
+ Medium
+ Fast
+ Custom
Clock
Date
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index e080c55b3..3a914d488 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -24,6 +24,7 @@ using System.Windows.Data;
using ModernWpf.Controls;
using Key = System.Windows.Input.Key;
using System.Media;
+using static Flow.Launcher.ViewModel.SettingWindowViewModel;
namespace Flow.Launcher
{
@@ -379,11 +380,19 @@ namespace Flow.Launcher
CircleEase easing = new CircleEase();
easing.EasingMode = EasingMode.EaseInOut;
+ var animationLength = _settings.AnimationSpeed switch
+ {
+ AnimationSpeeds.Slow => 560,
+ AnimationSpeeds.Medium => 360,
+ AnimationSpeeds.Fast => 160,
+ _ => _settings.CustomAnimationLength
+ };
+
var WindowOpacity = new DoubleAnimation
{
From = 0,
To = 1,
- Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength * 2 / 3),
+ Duration = TimeSpan.FromMilliseconds(animationLength * 2 / 3),
FillBehavior = FillBehavior.Stop
};
@@ -391,7 +400,7 @@ namespace Flow.Launcher
{
From = Top + 10,
To = Top,
- Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength * 2 / 3),
+ Duration = TimeSpan.FromMilliseconds(animationLength * 2 / 3),
FillBehavior = FillBehavior.Stop
};
var IconMotion = new DoubleAnimation
@@ -399,7 +408,7 @@ namespace Flow.Launcher
From = 12,
To = 0,
EasingFunction = easing,
- Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
+ Duration = TimeSpan.FromMilliseconds(animationLength),
FillBehavior = FillBehavior.Stop
};
@@ -408,7 +417,7 @@ namespace Flow.Launcher
From = 0,
To = 1,
EasingFunction = easing,
- Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
+ Duration = TimeSpan.FromMilliseconds(animationLength),
FillBehavior = FillBehavior.Stop
};
double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style
@@ -417,7 +426,7 @@ namespace Flow.Launcher
From = 0,
To = TargetIconOpacity,
EasingFunction = easing,
- Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
+ Duration = TimeSpan.FromMilliseconds(animationLength),
FillBehavior = FillBehavior.Stop
};
@@ -427,7 +436,7 @@ namespace Flow.Launcher
From = new Thickness(0, 12, right, 0),
To = new Thickness(0, 0, right, 0),
EasingFunction = easing,
- Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
+ Duration = TimeSpan.FromMilliseconds(animationLength),
FillBehavior = FillBehavior.Stop
};
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index ce0b55de7..1e886c022 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -2403,6 +2403,7 @@
-
+
+
+
+
+
+
-
-
+
+
-
-
+ DisplayMemberPath="Display"
+ FontSize="14"
+ ItemsSource="{Binding AnimationSpeeds}"
+ SelectedValue="{Binding Settings.AnimationSpeed}"
+ SelectedValuePath="Value">
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
+
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index d8d2801e5..231e65539 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -598,10 +598,31 @@ namespace Flow.Launcher.ViewModel
set => Settings.UseAnimation = value;
}
- public int AnimationLength
+ public class AnimationSpeed
{
- get => Settings.AnimationLength;
- set => Settings.AnimationLength = value;
+ public string Display { get; set; }
+ public AnimationSpeeds Value { get; set; }
+ }
+
+ public List AnimationSpeeds
+ {
+ get
+ {
+ List speeds = new List();
+ var enums = (AnimationSpeeds[])Enum.GetValues(typeof(AnimationSpeeds));
+ foreach (var e in enums)
+ {
+ var key = $"AnimationSpeed{e}";
+ var display = _translater.GetTranslation(key);
+ var m = new AnimationSpeed
+ {
+ Display = display,
+ Value = e,
+ };
+ speeds.Add(m);
+ }
+ return speeds;
+ }
}
public bool UseSound