diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index a188cd357..458aa498f 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -163,15 +163,17 @@ namespace Flow.Launcher.ViewModel
}
}
+ var loadFullImage = (Path.GetExtension(imagePath) ?? "").Equals(".url", StringComparison.OrdinalIgnoreCase);
+
if (ImageLoader.CacheContainImage(imagePath))
{
// will get here either when icoPath has value\icon delegate is null\when had exception in delegate
- image = ImageLoader.Load(imagePath);
+ image = ImageLoader.Load(imagePath, loadFullImage);
return;
}
// We need to modify the property not field here to trigger the OnPropertyChanged event
- Image = await Task.Run(() => ImageLoader.Load(imagePath)).ConfigureAwait(false);
+ Image = await Task.Run(() => ImageLoader.Load(imagePath, loadFullImage)).ConfigureAwait(false);
}
public Result Result { get; }
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj b/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj
index 2809e0b5c..83f9464c4 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj
@@ -58,6 +58,7 @@
+
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index 6a8b232e9..54e4dfa80 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -16,7 +16,10 @@ using System.Collections;
using System.Diagnostics;
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
using System.Diagnostics.CodeAnalysis;
+using System.Text.RegularExpressions;
using System.Threading.Channels;
+using Flow.Launcher.Infrastructure.Image;
+using IniParser;
namespace Flow.Launcher.Plugin.Program.Programs
{
@@ -36,6 +39,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
public string Location => ParentDirectory;
private const string ShortcutExtension = "lnk";
+ private const string UrlExtension = "url";
private const string ExeExtension = "exe";
private static readonly Win32 Default = new Win32()
@@ -287,6 +291,33 @@ namespace Flow.Launcher.Plugin.Program.Programs
#endif
}
+ private static Win32 UrlProgram(string path)
+ {
+ var program = Win32Program(path);
+
+ var parser = new FileIniDataParser();
+ var data = parser.ReadFile(path);
+
+ try
+ {
+ var urlSection = data["InternetShortcut"];
+
+ program.LnkResolvedPath = urlSection["URL"];
+
+ var iconPath = urlSection["IconFile"];
+ if (Path.GetExtension(iconPath).Equals(".ico", StringComparison.OrdinalIgnoreCase))
+ {
+ program.IcoPath = iconPath;
+ }
+ }
+ catch (Exception e)
+ {
+ // Many files do not have the required fields, so no logging is done.
+ }
+
+ return program;
+ }
+
private static Win32 ExeProgram(string path)
{
try
@@ -343,6 +374,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
ExeExtension => ExeProgram(x),
ShortcutExtension => LnkProgram(x),
+ UrlExtension => UrlProgram(x),
_ => Win32Program(x)
});
@@ -365,6 +397,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
.Select(x => Extension(x) switch
{
ShortcutExtension => LnkProgram(x),
+ UrlExtension => UrlProgram(x),
_ => Win32Program(x)
}).Where(x => x.Valid);
return programs;
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
index d97ddd993..d5f492389 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
@@ -9,7 +9,7 @@ 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[] ProgramSuffixes { get; set; } = {"appref-ms", "exe", "lnk"};
+ public string[] ProgramSuffixes { get; set; } = {"appref-ms", "exe", "lnk", "url"};
public bool EnableStartMenuSource { get; set; } = true;