diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml index 91e0fda1142..3132db36bf4 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml @@ -43,6 +43,9 @@ File Suffixes URL Protocols + Steam Games + Epic Games + Http/Https Custom URL Protocols Custom File Suffixes diff --git a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml index 1d0267e3da7..fbe538b7fa1 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml @@ -189,9 +189,9 @@ FontSize="16" FontWeight="SemiBold" Text="{DynamicResource flowlauncher_plugin_program_suffixes_URL_types}" /> - Steam Games - Epic Games - Http/Https + + + ProgramSources { get; set; } = new List(); public List DisabledProgramSources { get; set; } = new List(); - public string[] CustomSuffixes { get; set; } = Array.Empty(); + + [Obsolete, JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string[] ProgramSuffixes { get; set; } = null; + public string[] CustomSuffixes { get; set; } = Array.Empty(); // Custom suffixes only public string[] CustomProtocols { get; set; } = Array.Empty(); public Dictionary BuiltinSuffixesStatus { get; set; } = new Dictionary{ @@ -32,6 +36,7 @@ public class Settings public string[] GetSuffixes() { + RemoveRedundantSuffixes(); List extensions = new List(); foreach (var item in BuiltinSuffixesStatus) { @@ -84,6 +89,24 @@ public string[] GetProtocols() } } + private void RemoveRedundantSuffixes() + { + // Migrate to new settings + // CustomSuffixes no longer contains custom suffixes + // users has tweaked the settings + // or this function has been executed once + if (UseCustomSuffixes == true || ProgramSuffixes == null) + return; + var suffixes = ProgramSuffixes.ToList(); + foreach(var item in BuiltinSuffixesStatus) + { + suffixes.Remove(item.Key); + } + CustomSuffixes = suffixes.ToArray(); // Custom suffixes + UseCustomSuffixes = CustomSuffixes.Length != 0; // Search custom suffixes or not + ProgramSuffixes = null; + } + public bool EnableStartMenuSource { get; set; } = true; public bool EnableDescription { get; set; } = false; public bool HideAppsPath { get; set; } = true;