mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add Glyph Support
This commit is contained in:
parent
309ee29bda
commit
fd39b60f7b
3 changed files with 21 additions and 5 deletions
|
|
@ -47,7 +47,15 @@ namespace Flow.Launcher.Plugin
|
|||
|
||||
public delegate ImageSource IconDelegate();
|
||||
|
||||
public IconDelegate Icon;
|
||||
/// <summary>
|
||||
/// Delegate to Get Image Source
|
||||
/// </summary>
|
||||
public IconDelegate Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Information for Glyph Icon
|
||||
/// </summary>
|
||||
public GlyphInfo Glyph { get; init; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,10 @@
|
|||
<ColumnDefinition Width="0" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="ImageIcon" Width="32" Height="32" HorizontalAlignment="Left"
|
||||
Source="{Binding Image.Value}" />
|
||||
Source="{Binding Image.Value}" Visibility="{Binding ShowImage}" />
|
||||
<TextBlock Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Text="{Binding Glyph.Glyph}" FontFamily="{Binding Glyph.FontFamily}" FontSize="24"
|
||||
Visibility="{Binding ShowGlyph}"/>
|
||||
<Grid Margin="5 0 5 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
OnPropertyChanged(nameof(Image));
|
||||
});
|
||||
}
|
||||
|
||||
Glyph = Result.Glyph;
|
||||
}
|
||||
|
||||
Settings = settings;
|
||||
}
|
||||
|
|
@ -74,7 +76,8 @@ namespace Flow.Launcher.ViewModel
|
|||
public Settings Settings { get; private set; }
|
||||
|
||||
public Visibility ShowOpenResultHotkey => Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Hidden;
|
||||
|
||||
public Visibility ShowIcon => Result.IcoPath != null || Result.Icon is not null || Glyph == null ? Visibility.Visible : Visibility.Hidden;
|
||||
public Visibility ShowGlyph => Glyph is not null ? Visibility.Visible : Visibility.Hidden;
|
||||
public string OpenResultModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip)
|
||||
|
|
@ -87,6 +90,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public LazyAsync<ImageSource> Image { get; set; }
|
||||
|
||||
public GlyphInfo Glyph { get; set; }
|
||||
|
||||
private async ValueTask<ImageSource> SetImage()
|
||||
{
|
||||
var imagePath = Result.IcoPath;
|
||||
|
|
@ -106,7 +111,7 @@ namespace Flow.Launcher.ViewModel
|
|||
if (ImageLoader.CacheContainImage(imagePath))
|
||||
// will get here either when icoPath has value\icon delegate is null\when had exception in delegate
|
||||
return ImageLoader.Load(imagePath);
|
||||
|
||||
|
||||
return await Task.Run(() => ImageLoader.Load(imagePath));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue