From dd210ad41968a1e9112fb6b364a08093534ae136 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Tue, 8 Apr 2025 16:41:06 +0800
Subject: [PATCH] Remove RefreshFrameAsync since ChangeTheme calls this
function
---
Flow.Launcher.Core/Resource/Theme.cs | 2 +-
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 6 ++++--
Flow.Launcher/PublicAPIInstance.cs | 5 +----
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs
index d7c619330..59e76e2d2 100644
--- a/Flow.Launcher.Core/Resource/Theme.cs
+++ b/Flow.Launcher.Core/Resource/Theme.cs
@@ -433,7 +433,7 @@ namespace Flow.Launcher.Core.Resource
BlurEnabled = IsBlurTheme();
- // Can only apply blur but here also apply drop shadow effect to avoid possible drop shadow effect issues
+ // Apply blur and drop shadow effect so that we do not need to call it again
_ = RefreshFrameAsync();
return true;
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index 056c4a437..7701fcdd0 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -367,8 +367,10 @@ namespace Flow.Launcher.Plugin
/// Set the current theme
///
///
- ///
- public void SetCurrentTheme(ThemeData theme);
+ ///
+ /// True if the theme is set successfully, false otherwise.
+ ///
+ public bool SetCurrentTheme(ThemeData theme);
/// Load image from path. Support local, remote and data:image url.
/// If image path is missing, it will return a missing icon.
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index b19b21db1..8cce460d7 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -377,11 +377,8 @@ namespace Flow.Launcher
public ThemeData GetCurrentTheme() => Theme.GetCurrentTheme();
- public void SetCurrentTheme(ThemeData theme)
- {
+ public bool SetCurrentTheme(ThemeData theme) =>
Theme.ChangeTheme(theme.FileNameWithoutExtension);
- _ = _theme.RefreshFrameAsync();
- }
public ValueTask LoadImageAsync(string path, bool loadFullImage = false, bool cacheImage = true) =>
ImageLoader.LoadAsync(path, loadFullImage, cacheImage);