From 7883e7a0a95c6609c5cf5622dfc7d4ac810c18fc Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 18 Oct 2025 10:35:23 +1100 Subject: [PATCH] add result IcoPath & Glyph + handling show badge switching --- Flow.Launcher/Storage/LastOpenedHistoryItem.cs | 2 ++ Flow.Launcher/Storage/QueryHistory.cs | 4 +++- Flow.Launcher/ViewModel/MainViewModel.cs | 10 +++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/Storage/LastOpenedHistoryItem.cs b/Flow.Launcher/Storage/LastOpenedHistoryItem.cs index 47647066c..c7f9144a7 100644 --- a/Flow.Launcher/Storage/LastOpenedHistoryItem.cs +++ b/Flow.Launcher/Storage/LastOpenedHistoryItem.cs @@ -10,6 +10,8 @@ public class LastOpenedHistoryItem public string PluginID { get; set; } = string.Empty; public string Query { get; set; } = string.Empty; public string RecordKey { get; set; } = string.Empty; + public string IcoPath { get; set; } = string.Empty; + public GlyphInfo Glyph { get; init; } = null; public DateTime ExecutedDateTime { get; set; } public bool Equals(Result r) diff --git a/Flow.Launcher/Storage/QueryHistory.cs b/Flow.Launcher/Storage/QueryHistory.cs index 8284f7eea..bcf080669 100644 --- a/Flow.Launcher/Storage/QueryHistory.cs +++ b/Flow.Launcher/Storage/QueryHistory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json.Serialization; @@ -59,6 +59,8 @@ namespace Flow.Launcher.Storage PluginID = result.PluginID, Query = result.OriginQuery.RawQuery, RecordKey = result.RecordKey, + IcoPath = result.IcoPath, + Glyph = result.Glyph, ExecutedDateTime = DateTime.Now }); } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index f0f4b257a..f26e0f60f 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; @@ -1349,7 +1349,9 @@ namespace Flow.Launcher.ViewModel Localize.executeQuery(h.Query) : h.Title, SubTitle = Localize.lastExecuteTime(h.ExecutedDateTime), - IcoPath = Constant.HistoryIcon, + IcoPath = Settings.ShowBadges ? h.IcoPath : Constant.HistoryIcon, + BadgeIcoPath = Settings.ShowBadges ? Constant.HistoryIcon : h.IcoPath, + ShowBadge = Settings.ShowBadges, OriginQuery = new Query { RawQuery = h.Query }, AsyncAction = async c => { @@ -1369,7 +1371,9 @@ namespace Flow.Launcher.ViewModel App.API.ChangeQuery(h.Query); return false; }, - Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uE81C") + Glyph = Settings.ShowBadges ? + h.Glyph is not null ? h.Glyph : null + : new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uE81C") }; results.Add(result); }