add result IcoPath & Glyph + handling show badge switching

This commit is contained in:
Jeremy 2025-10-18 10:35:23 +11:00
parent da4b961686
commit 7883e7a0a9
3 changed files with 12 additions and 4 deletions

View file

@ -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)

View file

@ -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
});
}

View file

@ -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);
}