From d8f4eac0d2c1dc094802c41e307fab53c9f17643 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 12 Apr 2025 20:10:24 +0800
Subject: [PATCH] Add ShowBadge property
---
Flow.Launcher.Plugin/Result.cs | 6 ++++++
Flow.Launcher/ViewModel/ResultViewModel.cs | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs
index ac00d5af5..059f5c3f6 100644
--- a/Flow.Launcher.Plugin/Result.cs
+++ b/Flow.Launcher.Plugin/Result.cs
@@ -251,6 +251,12 @@ namespace Flow.Launcher.Plugin
///
public string RecordKey { get; set; } = null;
+ ///
+ /// Determines if the badge icon should be shown.
+ /// If users want to show the result badges and here you set this to true, the results will show the badge icon.
+ ///
+ public bool ShowBadge { get; set; } = false;
+
///
/// Run this result, asynchronously
///
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index 68c794aec..8d7569dc1 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -128,9 +128,13 @@ namespace Flow.Launcher.ViewModel
{
get
{
- if (!Settings.ShowBadges || !BadgeIconAvailable)
+ // If results do not allow badges, or user has disabled badges in settings,
+ // or badge icon is not available, then do not show badge
+ if (!Result.ShowBadge || !Settings.ShowBadges || !BadgeIconAvailable)
return Visibility.Collapsed;
+ // If user has set to show badges only for global results, and this is not a global result,
+ // then do not show badge
if (Settings.ShowBadgesGlobalOnly && !IsGlobalQuery)
return Visibility.Collapsed;