diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml
index 38202fcf316..b256e0f9af1 100644
--- a/Flow.Launcher/ResultListBox.xaml
+++ b/Flow.Launcher/ResultListBox.xaml
@@ -73,12 +73,15 @@
VerticalAlignment="Center"
Style="{DynamicResource ItemHotkeyStyle}">
-
+
-
+
@@ -95,53 +98,84 @@
Grid.Column="0"
Style="{DynamicResource BulletStyle}" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Source="{Binding PluginIcon}">
-
-
-
-
+
+
-
+
@@ -247,8 +283,10 @@
-
-
+
+
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index 5130e7ebafc..fbfb7202055 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -9,6 +9,7 @@
using System.IO;
using System.Drawing.Text;
using System.Collections.Generic;
+using Flow.Launcher.Core.Plugin;
namespace Flow.Launcher.ViewModel
{
@@ -25,6 +26,7 @@ public ResultViewModel(Result result, Settings settings)
{
return;
}
+
Result = result;
if (Result.Glyph is { FontFamily: not null } glyph)
@@ -41,19 +43,14 @@ public ResultViewModel(Result result, Settings settings)
if (fonts.ContainsKey(fontFamilyPath))
{
- Glyph = glyph with
- {
- FontFamily = fonts[fontFamilyPath]
- };
+ Glyph = glyph with { FontFamily = fonts[fontFamilyPath] };
}
else
{
fontCollection.AddFontFile(fontFamilyPath);
- fonts[fontFamilyPath] = $"{Path.GetDirectoryName(fontFamilyPath)}/#{fontCollection.Families[^1].Name}";
- Glyph = glyph with
- {
- FontFamily = fonts[fontFamilyPath]
- };
+ fonts[fontFamilyPath] =
+ $"{Path.GetDirectoryName(fontFamilyPath)}/#{fontCollection.Families[^1].Name}";
+ Glyph = glyph with { FontFamily = fonts[fontFamilyPath] };
}
}
else
@@ -61,7 +58,6 @@ public ResultViewModel(Result result, Settings settings)
Glyph = glyph;
}
}
-
}
public Settings Settings { get; }
@@ -71,7 +67,8 @@ public ResultViewModel(Result result, Settings settings)
public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed;
- public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;
+ public Visibility ShowCustomizedPreview =>
+ Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;
public Visibility ShowIcon
{
@@ -114,9 +111,9 @@ public double IconRadius
{
return IconXY / 2;
}
+
return IconXY;
}
-
}
public Visibility ShowGlyph
@@ -136,7 +133,8 @@ public Visibility ShowGlyph
private bool ImgIconAvailable => !string.IsNullOrEmpty(Result.IcoPath) || Result.Icon is not null;
- private bool PreviewImageAvailable => !string.IsNullOrEmpty(Result.Preview.PreviewImagePath) || Result.Preview.PreviewDelegate != null;
+ private bool PreviewImageAvailable => !string.IsNullOrEmpty(Result.Preview.PreviewImagePath) ||
+ Result.Preview.PreviewDelegate != null;
public string OpenResultModifiers => Settings.OpenResultModifiers;
@@ -148,19 +146,42 @@ public Visibility ShowGlyph
? Result.SubTitle
: Result.SubTitleToolTip;
- private volatile bool ImageLoaded;
- private volatile bool PreviewImageLoaded;
+ private volatile bool imageLoaded;
+ private volatile bool pluginIconLoaded;
+ private volatile bool previewImageLoaded;
private ImageSource image = ImageLoader.LoadingImage;
private ImageSource previewImage = ImageLoader.LoadingImage;
+ private ImageSource pluginIcon = ImageLoader.LoadingImage;
+
+ public ImageSource PluginIcon
+ {
+ get
+ {
+ if (!pluginIconLoaded)
+ {
+ pluginIconLoaded = true;
+ _ = LoadPluginIconAsync();
+ }
+
+ return pluginIcon;
+ }
+ private set => pluginIcon = value;
+ }
+
+ private async Task LoadPluginIconAsync()
+ {
+ PluginIcon = await ImageLoader.LoadAsync(PluginManager.GetPluginForId(Result.PluginID).Metadata.IcoPath)
+ .ConfigureAwait(false);
+ }
public ImageSource Image
{
get
{
- if (!ImageLoaded)
+ if (!imageLoaded)
{
- ImageLoaded = true;
+ imageLoaded = true;
_ = LoadImageAsync();
}
@@ -182,7 +203,8 @@ public ImageSource PreviewImage
public GlyphInfo Glyph { get; set; }
- private async Task LoadImageInternalAsync(string imagePath, Result.IconDelegate icon, bool loadFullImage)
+ private async Task LoadImageInternalAsync(string imagePath, Result.IconDelegate icon,
+ bool loadFullImage)
{
if (string.IsNullOrEmpty(imagePath) && icon != null)
{
@@ -236,15 +258,16 @@ public void LoadPreviewImage()
{
if (ShowDefaultPreview == Visibility.Visible)
{
- if (!PreviewImageLoaded && ShowPreviewImage == Visibility.Visible)
+ if (!previewImageLoaded && ShowPreviewImage == Visibility.Visible)
{
- PreviewImageLoaded = true;
+ previewImageLoaded = true;
_ = LoadPreviewImageAsync();
}
}
}
public Result Result { get; }
+
public int ResultProgress
{
get