diff --git a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml
index 5a0f0eb1b..b0b110207 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml
@@ -167,9 +167,9 @@
FontSize="16"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncher_plugin_program_suffixes_excutable_types}" />
- appref-ms
- exe
- lnk
+ appref-ms
+ exe
+ lnk
- Steam Games
- Epic Games
- Http/Https
+ Steam Games
+ Epic Games
+ Http/Https
SuffixesStaus => _settings.BuiltinSuffixesStatus;
+ public Settings _settings;
+ public Dictionary SuffixesStatus => _settings.BuiltinSuffixesStatus;
+ public Dictionary ProtocolsStatus => _settings.BuiltinProtocolsStatus;
public ProgramSuffixes(PluginInitContext context, Settings settings)
{
@@ -16,6 +17,7 @@ namespace Flow.Launcher.Plugin.Program
_settings = settings;
InitializeComponent();
tbSuffixes.Text = string.Join(Settings.SuffixSeperator, _settings.CustomSuffixes);
+ tbProtocols.Text = string.Join(Settings.SuffixSeperator, _settings.CustomProtocols);
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
@@ -26,6 +28,7 @@ namespace Flow.Launcher.Plugin.Program
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
{
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
+ var protocols = tbProtocols.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
if (suffixes.Length == 0 && _settings.UseCustomSuffixes)
{
@@ -34,10 +37,15 @@ namespace Flow.Launcher.Plugin.Program
return;
}
- _settings.CustomSuffixes = suffixes;
+ if (protocols.Length == 0 && _settings.UseCustomProtocols)
+ {
+ string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty"); // TODO text update
+ MessageBox.Show(warning);
+ return;
+ }
- //string msg = context.API.GetTranslation("flowlauncher_plugin_program_update_file_suffixes");
- //MessageBox.Show(msg);
+ _settings.CustomSuffixes = suffixes;
+ _settings.CustomProtocols = protocols;
DialogResult = true;
}
@@ -49,6 +57,10 @@ namespace Flow.Launcher.Plugin.Program
lnk.IsChecked = true;
CustomFiles.IsChecked = false;
+ steam.IsChecked = true;
+ epic.IsChecked = true;
+ http.IsChecked = false;
+ CustomProtocol.IsChecked = false;
}
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index 469a7133a..a86c454be 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -294,17 +294,28 @@ namespace Flow.Launcher.Plugin.Program.Programs
private static Win32 UrlProgram(string path)
{
var program = Win32Program(path);
-
- var parser = new FileIniDataParser();
- var data = parser.ReadFile(path);
+ program.Valid = false;
try
{
+ var parser = new FileIniDataParser();
+ var data = parser.ReadFile(path);
var urlSection = data["InternetShortcut"];
+ if (urlSection != null)
+ {
+ var url = urlSection["URL"];
+ foreach(var protocol in Main._settings.GetProtocols())
+ {
+ if(url.StartsWith(protocol))
+ {
+ program.LnkResolvedPath = url;
+ program.Valid = true;
+ break;
+ }
+ }
+ }
- program.LnkResolvedPath = urlSection["URL"];
-
- var iconPath = urlSection["IconFile"];
+ var iconPath = urlSection["IconFile"];
if (Path.GetExtension(iconPath).Equals(".ico", StringComparison.OrdinalIgnoreCase))
{
program.IcoPath = iconPath;
@@ -537,7 +548,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
var programs = Enumerable.Empty();
- var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.GetProgramExtensions());
+ var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.GetSuffixes());
programs = programs.Concat(unregistered);
@@ -545,13 +556,13 @@ namespace Flow.Launcher.Plugin.Program.Programs
if (settings.EnableRegistrySource)
{
- var appPaths = AppPathsPrograms(settings.GetProgramExtensions());
+ var appPaths = AppPathsPrograms(settings.GetSuffixes());
autoIndexPrograms = autoIndexPrograms.Concat(appPaths);
}
if (settings.EnableStartMenuSource)
{
- var startMenu = StartMenuPrograms(settings.GetProgramExtensions());
+ var startMenu = StartMenuPrograms(settings.GetSuffixes());
autoIndexPrograms = autoIndexPrograms.Concat(startMenu);
}
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
index 92335e38b..407cee969 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
@@ -11,17 +11,23 @@ namespace Flow.Launcher.Plugin.Program
public DateTime LastIndexTime { get; set; }
public List ProgramSources { get; set; } = new List();
public List DisabledProgramSources { get; set; } = new List();
- public string[] CustomSuffixes { get; set; } = { };
+ public string[] CustomSuffixes { get; set; } = Array.Empty();
+ public string[] CustomProtocols { get; set; } = Array.Empty();
[JsonIgnore]
public Dictionary BuiltinSuffixesStatus { get; set; } = new Dictionary{
{ "exe", true }, { "appref-ms", true }, { "lnk", true }
};
+ [JsonIgnore]
+ public Dictionary BuiltinProtocolsStatus { get; set; } = new Dictionary{
+ { $"steam://run/{SuffixSeperator}steam://rungameid/", true }, { "com.epicgames.launcher://apps/", true }, { $"http://{SuffixSeperator}https://", false}
+ };
+
public bool UseCustomSuffixes = false;
public bool UseCustomProtocols = false;
- public string[] GetProgramExtensions()
+ public string[] GetSuffixes()
{
List extensions = new List();
foreach(var item in BuiltinSuffixesStatus)
@@ -32,7 +38,10 @@ namespace Flow.Launcher.Plugin.Program
}
}
- // todo: url
+ if (BuiltinProtocolsStatus.Values.Any(x => x == true) || UseCustomProtocols)
+ {
+ extensions.Add("url");
+ }
if (UseCustomSuffixes)
{
@@ -40,12 +49,36 @@ namespace Flow.Launcher.Plugin.Program
}
else
{
- return extensions.ToArray();
+ return extensions.DistinctBy(x => x.ToLower()).ToArray();
+ }
+ }
+
+ public string[] GetProtocols()
+ {
+ List protocols = new List();
+ foreach (var item in BuiltinProtocolsStatus)
+ {
+ if (item.Value)
+ {
+ var tmp = item.Key.Split(SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
+ foreach(var p in tmp)
+ {
+ protocols.Add(p);
+ }
+ }
+ }
+
+ if (UseCustomProtocols)
+ {
+ return protocols.Concat(CustomProtocols).DistinctBy(x => x.ToLower()).ToArray();
+ }
+ else
+ {
+ return protocols.DistinctBy(x => x.ToLower()).ToArray();
}
}
public bool EnableStartMenuSource { get; set; } = true;
-
public bool EnableDescription { get; set; } = false;
public bool HideAppsPath { get; set; } = true;
public bool EnableRegistrySource { get; set; } = true;