From 1b31e9c9685abd0d1d556d260425fac4b5aff165 Mon Sep 17 00:00:00 2001
From: Odotocodot <48138990+Odotocodot@users.noreply.github.com>
Date: Thu, 30 Nov 2023 14:37:05 +0000
Subject: [PATCH 01/36] Create Flow Launcher Theme Selector plugin
---
...w.Launcher.Plugin.FlowThemeSelector.csproj | 37 +++++++
.../Main.cs | 91 ++++++++++++++++++
.../icon.png | Bin 0 -> 6625 bytes
.../plugin.json | 12 +++
4 files changed, 140 insertions(+)
create mode 100644 Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj
create mode 100644 Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs
create mode 100644 Plugins/Flow.Launcher.Plugin.FlowThemeSelector/icon.png
create mode 100644 Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj
new file mode 100644
index 000000000..ba0ddd6ab
--- /dev/null
+++ b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj
@@ -0,0 +1,37 @@
+
+
+
+
+ Library
+ net7.0-windows
+ true
+ false
+
+
+
+ ..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.FlowThemeSelector
+
+
+
+ ..\..\Output\Release\Plugins\Flow.Launcher.Plugin.FlowThemeSelector
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs
new file mode 100644
index 000000000..6fd6472db
--- /dev/null
+++ b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Flow.Launcher.Core.Resource;
+
+namespace Flow.Launcher.Plugin.FlowThemeSelector
+{
+ public class FlowThemeSelector : IPlugin, IReloadable, IDisposable
+ {
+ private PluginInitContext context;
+ private IEnumerable themes;
+
+ public void Init(PluginInitContext context)
+ {
+ this.context = context;
+ context.API.VisibilityChanged += OnVisibilityChanged;
+ }
+
+ public List Query(Query query)
+ {
+ if (query.IsReQuery)
+ {
+ LoadThemes();
+ }
+
+ if (string.IsNullOrWhiteSpace(query.Search))
+ {
+ return themes.Select(CreateThemeResult)
+ .OrderBy(x => x.Title)
+ .ToList();
+ }
+
+ return themes.Select(theme => (theme, matchResult: context.API.FuzzySearch(query.Search, theme)))
+ .Where(x => x.matchResult.IsSearchPrecisionScoreMet())
+ .Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
+ .OrderBy(x => x.Title)
+ .ToList();
+ }
+
+ private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs args)
+ {
+ if (args.IsVisible && !context.CurrentPluginMetadata.Disabled)
+ {
+ LoadThemes();
+ }
+ }
+
+ public void LoadThemes() => themes = ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension);
+
+ public static Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
+
+ public static Result CreateThemeResult(string theme, int score, IList highlightData)
+ {
+ string title;
+ if (theme == ThemeManager.Instance.Settings.Theme)
+ {
+ title = $"{theme} ★";
+ score = 2000;
+ }
+ else
+ {
+ title = theme;
+ }
+
+ return new Result
+ {
+ Title = title,
+ TitleHighlightData = highlightData,
+ Glyph = new GlyphInfo("/Resources/#Segoe Fluent Icons", "\ue790"),
+ Score = score,
+ Action = c =>
+ {
+ ThemeManager.Instance.ChangeTheme(theme);
+ return true;
+ }
+ };
+ }
+
+ public void ReloadData() => LoadThemes();
+
+ public void Dispose()
+ {
+ if (context != null && context.API != null)
+ {
+ context.API.VisibilityChanged -= OnVisibilityChanged;
+ }
+ }
+
+ }
+}
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/icon.png b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..704e9474eb29ffa1fcaeff9e24c60ee35155afd5
GIT binary patch
literal 6625
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
literal 0
HcmV?d00001
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json
new file mode 100644
index 000000000..f275d129c
--- /dev/null
+++ b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json
@@ -0,0 +1,12 @@
+{
+ "ID": "4DFA743E1086414BAB0AA3071D561D75",
+ "ActionKeyword": "flowtheme",
+ "Name": "Flow Launcher Theme Selector",
+ "Description": "Quickly switch your Flow Launcher theme.",
+ "Author": "Odotocodot",
+ "Version": "1.0.0",
+ "Language": "csharp",
+ "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
+ "IcoPath": "icon.png",
+ "ExecuteFileName": "Flow.Launcher.Plugin.FlowThemeSelector.dll"
+}
\ No newline at end of file
From 49a71d7d53a3c66a3feac30f743f625f47059f83 Mon Sep 17 00:00:00 2001
From: Odotocodot <48138990+Odotocodot@users.noreply.github.com>
Date: Sat, 15 Jun 2024 12:16:36 +0100
Subject: [PATCH 02/36] Move Theme Selector into Sys plugin
---
...w.Launcher.Plugin.FlowThemeSelector.csproj | 37 ------------------
.../plugin.json | 12 ------
.../Flow.Launcher.Plugin.Sys.csproj | 1 +
.../Images/theme_selector.png} | Bin
.../Languages/en.xaml | 4 +-
Plugins/Flow.Launcher.Plugin.Sys/Main.cs | 29 +++++++++++++-
.../ThemeSelector.cs} | 24 +++++++-----
7 files changed, 45 insertions(+), 62 deletions(-)
delete mode 100644 Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj
delete mode 100644 Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json
rename Plugins/{Flow.Launcher.Plugin.FlowThemeSelector/icon.png => Flow.Launcher.Plugin.Sys/Images/theme_selector.png} (100%)
rename Plugins/{Flow.Launcher.Plugin.FlowThemeSelector/Main.cs => Flow.Launcher.Plugin.Sys/ThemeSelector.cs} (72%)
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj
deleted file mode 100644
index ba0ddd6ab..000000000
--- a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Flow.Launcher.Plugin.FlowThemeSelector.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- Library
- net7.0-windows
- true
- false
-
-
-
- ..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.FlowThemeSelector
-
-
-
- ..\..\Output\Release\Plugins\Flow.Launcher.Plugin.FlowThemeSelector
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
- PreserveNewest
-
-
-
-
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json b/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json
deleted file mode 100644
index f275d129c..000000000
--- a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/plugin.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "ID": "4DFA743E1086414BAB0AA3071D561D75",
- "ActionKeyword": "flowtheme",
- "Name": "Flow Launcher Theme Selector",
- "Description": "Quickly switch your Flow Launcher theme.",
- "Author": "Odotocodot",
- "Version": "1.0.0",
- "Language": "csharp",
- "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
- "IcoPath": "icon.png",
- "ExecuteFileName": "Flow.Launcher.Plugin.FlowThemeSelector.dll"
-}
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj b/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj
index c7a722189..bba466384 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj
@@ -38,6 +38,7 @@
+
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/icon.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/theme_selector.png
similarity index 100%
rename from Plugins/Flow.Launcher.Plugin.FlowThemeSelector/icon.png
rename to Plugins/Flow.Launcher.Plugin.Sys/Images/theme_selector.png
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml
index 91f32a844..2a266f8f6 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml
@@ -27,6 +27,7 @@
Flow Launcher Tips
Flow Launcher UserData Folder
Toggle Game Mode
+ Set the Flow Launcher Theme
Shutdown Computer
@@ -49,8 +50,9 @@
Visit Flow Launcher's documentation for more help and how to use tips
Open the location where Flow Launcher's settings are stored
Toggle Game Mode
+ Quickly change the Flow Launcher theme
-
+
Success
All Flow Launcher settings saved
Reloaded all applicable plugin data
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
index 1ec07915d..0dbb46be9 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
@@ -18,9 +18,10 @@ using MessageBox = System.Windows.MessageBox;
namespace Flow.Launcher.Plugin.Sys
{
- public class Main : IPlugin, ISettingProvider, IPluginI18n
+ public class Main : IPlugin, ISettingProvider, IPluginI18n, IDisposable
{
private PluginInitContext context;
+ private ThemeSelector themeSelector;
private Dictionary KeywordTitleMappings = new Dictionary();
#region DllImport
@@ -58,6 +59,11 @@ namespace Flow.Launcher.Plugin.Sys
public List Query(Query query)
{
+ if(query.Search.StartsWith(ThemeSelector.Keyword))
+ {
+ return themeSelector.Query(query);
+ }
+
var commands = Commands();
var results = new List();
foreach (var c in commands)
@@ -106,6 +112,7 @@ namespace Flow.Launcher.Plugin.Sys
public void Init(PluginInitContext context)
{
this.context = context;
+ themeSelector = new ThemeSelector(context);
KeywordTitleMappings = new Dictionary{
{"Shutdown", "flowlauncher_plugin_sys_shutdown_computer_cmd"},
{"Restart", "flowlauncher_plugin_sys_restart_computer_cmd"},
@@ -126,7 +133,8 @@ namespace Flow.Launcher.Plugin.Sys
{"Open Log Location", "flowlauncher_plugin_sys_open_log_location_cmd"},
{"Flow Launcher Tips", "flowlauncher_plugin_sys_open_docs_tips_cmd"},
{"Flow Launcher UserData Folder", "flowlauncher_plugin_sys_open_userdata_location_cmd"},
- {"Toggle Game Mode", "flowlauncher_plugin_sys_toggle_game_mode_cmd"}
+ {"Toggle Game Mode", "flowlauncher_plugin_sys_toggle_game_mode_cmd"},
+ {"Set Flow Launcher Theme", "flowlauncher_plugin_sys_theme_selector_cmd"}
};
}
@@ -426,6 +434,18 @@ namespace Flow.Launcher.Plugin.Sys
context.API.ToggleGameMode();
return true;
}
+ },
+ new Result
+ {
+ Title = "Set Flow Launcher Theme",
+ SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_theme_selector"),
+ IcoPath = "Images\\theme_selector.png",
+ Glyph = new GlyphInfo("/Resources/#Segoe Fluent Icons", "\ue790"),
+ Action = c =>
+ {
+ context.API.ChangeQuery($"{ThemeSelector.Keyword} ");
+ return false;
+ }
}
});
@@ -441,5 +461,10 @@ namespace Flow.Launcher.Plugin.Sys
{
return context.API.GetTranslation("flowlauncher_plugin_sys_plugin_description");
}
+
+ public void Dispose()
+ {
+ themeSelector.Dispose();
+ }
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
similarity index 72%
rename from Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs
rename to Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 6fd6472db..24d17486e 100644
--- a/Plugins/Flow.Launcher.Plugin.FlowThemeSelector/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -4,14 +4,16 @@ using System.IO;
using System.Linq;
using Flow.Launcher.Core.Resource;
-namespace Flow.Launcher.Plugin.FlowThemeSelector
+namespace Flow.Launcher.Plugin.Sys
{
- public class FlowThemeSelector : IPlugin, IReloadable, IDisposable
+ public class ThemeSelector : IReloadable, IDisposable
{
- private PluginInitContext context;
+ public const string Keyword = "fltheme";
+
+ private readonly PluginInitContext context;
private IEnumerable themes;
- public void Init(PluginInitContext context)
+ public ThemeSelector(PluginInitContext context)
{
this.context = context;
context.API.VisibilityChanged += OnVisibilityChanged;
@@ -24,14 +26,16 @@ namespace Flow.Launcher.Plugin.FlowThemeSelector
LoadThemes();
}
- if (string.IsNullOrWhiteSpace(query.Search))
+ string search = query.Search[(query.Search.IndexOf(Keyword, StringComparison.Ordinal) + Keyword.Length + 1)..];
+
+ if (string.IsNullOrWhiteSpace(search))
{
return themes.Select(CreateThemeResult)
.OrderBy(x => x.Title)
.ToList();
}
- return themes.Select(theme => (theme, matchResult: context.API.FuzzySearch(query.Search, theme)))
+ return themes.Select(theme => (theme, matchResult: context.API.FuzzySearch(search, theme)))
.Where(x => x.matchResult.IsSearchPrecisionScoreMet())
.Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
.OrderBy(x => x.Title)
@@ -46,11 +50,12 @@ namespace Flow.Launcher.Plugin.FlowThemeSelector
}
}
- public void LoadThemes() => themes = ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension);
+ private void LoadThemes()
+ => themes = ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension);
- public static Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
+ private static Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
- public static Result CreateThemeResult(string theme, int score, IList highlightData)
+ private static Result CreateThemeResult(string theme, int score, IList highlightData)
{
string title;
if (theme == ThemeManager.Instance.Settings.Theme)
@@ -86,6 +91,5 @@ namespace Flow.Launcher.Plugin.FlowThemeSelector
context.API.VisibilityChanged -= OnVisibilityChanged;
}
}
-
}
}
From 7a0be2c6103939312eeead86c3a1e01a3d618a3f Mon Sep 17 00:00:00 2001
From: Odotocodot <48138990+Odotocodot@users.noreply.github.com>
Date: Mon, 17 Jun 2024 16:50:00 +0100
Subject: [PATCH 03/36] Remove Reloadable from theme selector
---
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 24d17486e..758250421 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -6,7 +6,7 @@ using Flow.Launcher.Core.Resource;
namespace Flow.Launcher.Plugin.Sys
{
- public class ThemeSelector : IReloadable, IDisposable
+ public class ThemeSelector : IDisposable
{
public const string Keyword = "fltheme";
@@ -82,8 +82,6 @@ namespace Flow.Launcher.Plugin.Sys
};
}
- public void ReloadData() => LoadThemes();
-
public void Dispose()
{
if (context != null && context.API != null)
From 874a785be40cf57755fd0ebadfb554f6517ac8e8 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Sat, 18 Jan 2025 21:06:11 +1100
Subject: [PATCH 04/36] cache keywordIndex
---
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 758250421..d48583f26 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -26,20 +26,21 @@ namespace Flow.Launcher.Plugin.Sys
LoadThemes();
}
- string search = query.Search[(query.Search.IndexOf(Keyword, StringComparison.Ordinal) + Keyword.Length + 1)..];
+ int keywordIndex = query.Search.IndexOf(Keyword, StringComparison.Ordinal);
+ string search = query.Search[(keywordIndex + Keyword.Length + 1)..];
if (string.IsNullOrWhiteSpace(search))
{
return themes.Select(CreateThemeResult)
- .OrderBy(x => x.Title)
- .ToList();
+ .OrderBy(x => x.Title)
+ .ToList();
}
return themes.Select(theme => (theme, matchResult: context.API.FuzzySearch(search, theme)))
- .Where(x => x.matchResult.IsSearchPrecisionScoreMet())
- .Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
- .OrderBy(x => x.Title)
- .ToList();
+ .Where(x => x.matchResult.IsSearchPrecisionScoreMet())
+ .Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
+ .OrderBy(x => x.Title)
+ .ToList();
}
private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs args)
From 40050545005adcfaa2acec8f046deeaea79d3049 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Sat, 18 Jan 2025 21:16:04 +1100
Subject: [PATCH 05/36] implement the complete IDisposable pattern
---
.../Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 27 ++++++++++++++++---
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index d48583f26..ca19bd33d 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -83,12 +83,31 @@ namespace Flow.Launcher.Plugin.Sys
};
}
+ private bool disposed;
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposed)
+ {
+ if (disposing)
+ {
+ // Dispose managed resources
+ if (context?.API != null)
+ {
+ context.API.VisibilityChanged -= OnVisibilityChanged;
+ }
+ }
+ // Free unmanaged resources
+ disposed = true;
+ }
+ }
+ ~ThemeSelector()
+ {
+ Dispose(false);
+ }
public void Dispose()
{
- if (context != null && context.API != null)
- {
- context.API.VisibilityChanged -= OnVisibilityChanged;
- }
+ Dispose(true);
+ GC.SuppressFinalize(this);
}
}
}
From fce3b3ae3d7ebb59747e3a94fb4011acce325141 Mon Sep 17 00:00:00 2001
From: Odotocodot <48138990+Odotocodot@users.noreply.github.com>
Date: Sat, 18 Jan 2025 13:18:48 +0000
Subject: [PATCH 06/36] Fix crash on theme search
---
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index ca19bd33d..3ea90197d 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -26,8 +26,7 @@ namespace Flow.Launcher.Plugin.Sys
LoadThemes();
}
- int keywordIndex = query.Search.IndexOf(Keyword, StringComparison.Ordinal);
- string search = query.Search[(keywordIndex + Keyword.Length + 1)..];
+ string search = query.SecondToEndSearch;
if (string.IsNullOrWhiteSpace(search))
{
@@ -52,7 +51,7 @@ namespace Flow.Launcher.Plugin.Sys
}
private void LoadThemes()
- => themes = ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension);
+ => themes = ThemeManager.Instance.LoadAvailableThemes().Select(x => x.FileNameWithoutExtension);
private static Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
From 4e4758677f2b533fb6ed107f948ff7d7a1ab2570 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 1 Mar 2025 19:21:09 +0800
Subject: [PATCH 07/36] Remove unneccessary CreateSettingPanel by introducing
need check
---
Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs | 7 ++++++-
Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs | 9 +++++++--
Flow.Launcher/ViewModel/PluginViewModel.cs | 8 ++++----
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs
index ed8f94bcf..7248c6259 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginBase.cs
@@ -34,7 +34,7 @@ namespace Flow.Launcher.Core.Plugin
/// Represent the plugin that using JsonPRC
/// every JsonRPC plugin should has its own plugin instance
///
- internal abstract class JsonRPCPluginBase : IAsyncPlugin, IContextMenu, ISettingProvider, ISavable
+ public abstract class JsonRPCPluginBase : IAsyncPlugin, IContextMenu, ISettingProvider, ISavable
{
protected PluginInitContext Context;
public const string JsonRPC = "JsonRPC";
@@ -157,6 +157,11 @@ namespace Flow.Launcher.Core.Plugin
Settings?.Save();
}
+ public bool NeedCreateSettingPanel()
+ {
+ return Settings.NeedCreateSettingPanel();
+ }
+
public Control CreateSettingPanel()
{
return Settings.CreateSettingPanel();
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
index 2a4b22bf3..8412ba7e8 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
@@ -109,10 +109,15 @@ namespace Flow.Launcher.Core.Plugin
_storage.Save();
}
+ public bool NeedCreateSettingPanel()
+ {
+ // If there are no settings or the settings configuration is empty, return null
+ return Settings != null && Configuration != null && Configuration.Body.Count != 0;
+ }
+
public Control CreateSettingPanel()
{
- if (Settings == null || Settings.Count == 0)
- return null;
+ // No need to check if NeedCreateSettingPanel is true because CreateSettingPanel will only be called if it's true
var settingWindow = new UserControl();
var mainPanel = new Grid { Margin = settingPanelMargin, VerticalAlignment = VerticalAlignment.Center };
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index 46f8e00a2..209a81395 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -90,13 +90,13 @@ namespace Flow.Launcher.ViewModel
private Control _bottomPart2;
public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginDisplayBottomData() : null;
- public bool HasSettingControl => PluginPair.Plugin is ISettingProvider settingProvider && settingProvider.CreateSettingPanel() != null;
+ public bool HasSettingControl => PluginPair.Plugin is ISettingProvider && (PluginPair.Plugin is not JsonRPCPluginBase jsonRPCPluginBase || jsonRPCPluginBase.NeedCreateSettingPanel());
public Control SettingControl
=> IsExpanded
? _settingControl
- ??= PluginPair.Plugin is not ISettingProvider settingProvider
- ? null
- : settingProvider.CreateSettingPanel()
+ ??= HasSettingControl
+ ? ((ISettingProvider)PluginPair.Plugin).CreateSettingPanel()
+ : null
: null;
private ImageSource _image = ImageLoader.MissingImage;
From 889f4cbfeb4959477c3c3db8bdaf66c527cb902e Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Tue, 4 Mar 2025 11:08:09 +0800
Subject: [PATCH 08/36] Fix null reference exception when checking source
---
.../Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
index f4c8a66da..4ceadec56 100644
--- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
@@ -593,7 +593,10 @@ namespace Flow.Launcher.Plugin.PluginsManager
var constructedUrlPart = string.Format("{0}/{1}/", acceptedSource, author);
return url.StartsWith(acceptedSource) &&
- Context.API.GetAllPlugins().Any(x => x.Metadata.Website.StartsWith(constructedUrlPart));
+ Context.API.GetAllPlugins().Any(x =>
+ !string.IsNullOrEmpty(x.Metadata.Website) &&
+ x.Metadata.Website.StartsWith(constructedUrlPart)
+ );
}
internal async ValueTask> RequestInstallOrUpdateAsync(string search, CancellationToken token,
From 719d30ebf0a09e54a46948a786caa6069303ca0e Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Thu, 6 Mar 2025 07:41:22 +0800
Subject: [PATCH 09/36] Use official Task Scheduler
---
Flow.Launcher/Flow.Launcher.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj
index 33d13614f..8f6e47bbb 100644
--- a/Flow.Launcher/Flow.Launcher.csproj
+++ b/Flow.Launcher/Flow.Launcher.csproj
@@ -104,7 +104,7 @@
-
+
From 69b7aeadeb09cebd6e576c4817e01fe324522af4 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Thu, 6 Mar 2025 20:07:01 +0800
Subject: [PATCH 10/36] Update dependabot.yml
---
.github/dependabot.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index d9b39eb89..da4231f74 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -8,7 +8,8 @@ updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
- interval: "weekly"
+ interval: "daily"
+ open-pull-requests-limit: 3
ignore:
- dependency-name: "squirrel-windows"
reviewers:
From f2c30347a762f3a29b176d6730081be3d64e3e14 Mon Sep 17 00:00:00 2001
From: Yusyuriv
Date: Sat, 8 Mar 2025 12:24:47 +0600
Subject: [PATCH 11/36] Add new sponsor to README
---
README.md | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 02ffc7932..6611f55dc 100644
--- a/README.md
+++ b/README.md
@@ -334,11 +334,14 @@ Or download the [early access version](https://github.com/Flow-Launcher/Prerelea
-
-
+
+
+
+
+
From 8ca734ae065813062c119f78b8b8f2fb2d99f211 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 9 Mar 2025 03:18:48 +0000
Subject: [PATCH 12/36] Bump FSharp.Core from 9.0.101 to 9.0.201
Bumps [FSharp.Core](https://github.com/dotnet/fsharp) from 9.0.101 to 9.0.201.
- [Release notes](https://github.com/dotnet/fsharp/releases)
- [Changelog](https://github.com/dotnet/fsharp/blob/main/release-notes.md)
- [Commits](https://github.com/dotnet/fsharp/commits)
---
updated-dependencies:
- dependency-name: FSharp.Core
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Flow.Launcher.Core/Flow.Launcher.Core.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
index df2f4d2cb..5201d051a 100644
--- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj
+++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
@@ -54,7 +54,7 @@
-
+
From 66457b1dfb729a9ebed6e933f26ef9a3ecaa2709 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 9 Mar 2025 03:19:20 +0000
Subject: [PATCH 13/36] Bump MemoryPack from 1.21.3 to 1.21.4
Bumps [MemoryPack](https://github.com/Cysharp/MemoryPack) from 1.21.3 to 1.21.4.
- [Release notes](https://github.com/Cysharp/MemoryPack/releases)
- [Commits](https://github.com/Cysharp/MemoryPack/compare/1.21.3...1.21.4)
---
updated-dependencies:
- dependency-name: MemoryPack
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
.../Flow.Launcher.Infrastructure.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
index 5d8b26425..b91da7114 100644
--- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
+++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
@@ -59,7 +59,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
From c1a80158e609a2573b484793ea1baa499c699404 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 9 Mar 2025 07:24:13 +0000
Subject: [PATCH 14/36] Bump StreamJsonRpc from 2.20.20 to 2.21.10
Bumps [StreamJsonRpc](https://github.com/microsoft/vs-streamjsonrpc) from 2.20.20 to 2.21.10.
- [Release notes](https://github.com/microsoft/vs-streamjsonrpc/releases)
- [Commits](https://github.com/microsoft/vs-streamjsonrpc/commits)
---
updated-dependencies:
- dependency-name: StreamJsonRpc
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Flow.Launcher.Core/Flow.Launcher.Core.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
index 5201d051a..e9f199d00 100644
--- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj
+++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
@@ -58,7 +58,7 @@
-
+
From 65d42bf7c06aa26bb5e10c54e6cfb59e1519bc92 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 9 Mar 2025 07:25:00 +0000
Subject: [PATCH 15/36] Bump Microsoft.Data.Sqlite from 9.0.1 to 9.0.2
Bumps [Microsoft.Data.Sqlite](https://github.com/dotnet/efcore) from 9.0.1 to 9.0.2.
- [Release notes](https://github.com/dotnet/efcore/releases)
- [Commits](https://github.com/dotnet/efcore/compare/v9.0.1...v9.0.2)
---
updated-dependencies:
- dependency-name: Microsoft.Data.Sqlite
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
.../Flow.Launcher.Plugin.BrowserBookmark.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
index d7a626e1d..df534cb3f 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
@@ -95,7 +95,7 @@
-
+
From 8408a3cc544957d90033c34159f5a7391cbf135f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sun, 9 Mar 2025 07:57:00 +0000
Subject: [PATCH 16/36] Bump System.Data.OleDb from 8.0.1 to 9.0.2
Bumps [System.Data.OleDb](https://github.com/dotnet/runtime) from 8.0.1 to 9.0.2.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v9.0.2)
---
updated-dependencies:
- dependency-name: System.Data.OleDb
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
---
.../Flow.Launcher.Plugin.Explorer.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
index 29925aeef..f5691cb73 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
@@ -45,7 +45,7 @@
-
+
From 869fe5f94ac512603a923b1dc282eadc26553538 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Mon, 10 Mar 2025 09:41:17 +0800
Subject: [PATCH 17/36] Revert "Bump System.Data.OleDb from 8.0.1 to 9.0.2"
---
.../Flow.Launcher.Plugin.Explorer.csproj | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
index f5691cb73..549217027 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
@@ -45,7 +45,8 @@
-
+
+
From e870dd27eb2016f7d8101660d4e4d5449f82b995 Mon Sep 17 00:00:00 2001
From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 29 May 2024 23:48:04 +0800
Subject: [PATCH 18/36] Allow log level selection
---
Flow.Launcher.Infrastructure/Logger/Log.cs | 22 +++++++++++++++----
.../UserSettings/Settings.cs | 2 ++
Flow.Launcher/App.xaml.cs | 14 ++++++++++++
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Logger/Log.cs b/Flow.Launcher.Infrastructure/Logger/Log.cs
index d4bd473ac..cce62a1ac 100644
--- a/Flow.Launcher.Infrastructure/Logger/Log.cs
+++ b/Flow.Launcher.Infrastructure/Logger/Log.cs
@@ -48,17 +48,31 @@ namespace Flow.Launcher.Infrastructure.Logger
configuration.AddTarget("file", fileTargetASyncWrapper);
configuration.AddTarget("debug", debugTarget);
+ var fileRule = new LoggingRule("*", LogLevel.Debug, fileTargetASyncWrapper)
+ {
+ RuleName = "file"
+ };
#if DEBUG
- var fileRule = new LoggingRule("*", LogLevel.Debug, fileTargetASyncWrapper);
- var debugRule = new LoggingRule("*", LogLevel.Debug, debugTarget);
+ var debugRule = new LoggingRule("*", LogLevel.Debug, debugTarget)
+ {
+ RuleName = "debug"
+ };
configuration.LoggingRules.Add(debugRule);
-#else
- var fileRule = new LoggingRule("*", LogLevel.Info, fileTargetASyncWrapper);
#endif
configuration.LoggingRules.Add(fileRule);
LogManager.Configuration = configuration;
}
+ public static void UseDebugLogLevel()
+ {
+ LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
+ }
+
+ public static void UseInfoLogLevel()
+ {
+ LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Info, LogLevel.Fatal);
+ }
+
private static void LogFaultyFormat(string message)
{
var logger = LogManager.GetLogger("FaultyLogger");
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 0fb6e2b3c..25beb8bf6 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -199,6 +199,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
};
+ public string LogLevel = "info";
+
///
/// when false Alphabet static service will always return empty results
///
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 447eca792..6ec0424b8 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -122,6 +122,20 @@ namespace Flow.Launcher
var imageLoadertask = ImageLoader.InitializeAsync();
+ switch (_settings.LogLevel)
+ {
+ case "debug":
+ Log.UseDebugLogLevel();
+ break;
+ case "info":
+ Log.UseInfoLogLevel();
+ break;
+ default:
+ Log.Error(nameof(Flow.Launcher.App), "Unrecognized log level");
+ Log.UseDebugLogLevel();
+ break;
+ }
+
AbstractPluginEnvironment.PreStartPluginExecutablePathUpdate(_settings);
// TODO: Clean InternationalizationManager.Instance and InternationalizationManager.Instance.GetTranslation in future
From 44a90e53a918d3b580edb686b040d0c7cced8233 Mon Sep 17 00:00:00 2001
From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 11 Mar 2025 23:53:33 +0800
Subject: [PATCH 19/36] Write log level in log
---
Flow.Launcher.Infrastructure/Logger/Log.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Flow.Launcher.Infrastructure/Logger/Log.cs b/Flow.Launcher.Infrastructure/Logger/Log.cs
index cce62a1ac..3eb53e0a3 100644
--- a/Flow.Launcher.Infrastructure/Logger/Log.cs
+++ b/Flow.Launcher.Infrastructure/Logger/Log.cs
@@ -66,11 +66,13 @@ namespace Flow.Launcher.Infrastructure.Logger
public static void UseDebugLogLevel()
{
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
+ Info(nameof(Logger), "Using DEBUG log level.");
}
public static void UseInfoLogLevel()
{
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Info, LogLevel.Fatal);
+ Info(nameof(Logger), "Using INFO log level.");
}
private static void LogFaultyFormat(string message)
From 1dfa15d325e9f43336dcbd6eac1ee934e15f9de7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 11 Mar 2025 22:13:52 +0000
Subject: [PATCH 20/36] Bump Microsoft.Data.Sqlite from 9.0.2 to 9.0.3
Bumps [Microsoft.Data.Sqlite](https://github.com/dotnet/efcore) from 9.0.2 to 9.0.3.
- [Release notes](https://github.com/dotnet/efcore/releases)
- [Commits](https://github.com/dotnet/efcore/compare/v9.0.2...v9.0.3)
---
updated-dependencies:
- dependency-name: Microsoft.Data.Sqlite
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
.../Flow.Launcher.Plugin.BrowserBookmark.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
index df534cb3f..b4e42fbcd 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
@@ -95,7 +95,7 @@
-
+
From 8d3fd756dd2ef5ed79113e9d4d4568b45820dbdf Mon Sep 17 00:00:00 2001
From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 12 Mar 2025 08:57:03 +0800
Subject: [PATCH 21/36] Add getter and setter
---
Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 25beb8bf6..0a9d99777 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -199,7 +199,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
};
- public string LogLevel = "info";
+ public string LogLevel { get; set; } = "info";
///
/// when false Alphabet static service will always return empty results
From 11acca6215a9234c0ee055d6fef816d1bde933f8 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 12:01:39 +0800
Subject: [PATCH 22/36] Move log level to enum & Use info level as default
---
Flow.Launcher.Infrastructure/Logger/Log.cs | 10 ++++++++--
Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 4 +++-
Flow.Launcher/App.xaml.cs | 8 ++------
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Logger/Log.cs b/Flow.Launcher.Infrastructure/Logger/Log.cs
index 3eb53e0a3..2f368ac0c 100644
--- a/Flow.Launcher.Infrastructure/Logger/Log.cs
+++ b/Flow.Launcher.Infrastructure/Logger/Log.cs
@@ -66,13 +66,13 @@ namespace Flow.Launcher.Infrastructure.Logger
public static void UseDebugLogLevel()
{
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
- Info(nameof(Logger), "Using DEBUG log level.");
+ Info(nameof(Logger), "Using log level: DEBUG.");
}
public static void UseInfoLogLevel()
{
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Info, LogLevel.Fatal);
- Info(nameof(Logger), "Using INFO log level.");
+ Info(nameof(Logger), "Using log level: INFO.");
}
private static void LogFaultyFormat(string message)
@@ -222,4 +222,10 @@ namespace Flow.Launcher.Infrastructure.Logger
LogInternal(message, LogLevel.Warn);
}
}
+
+ public enum LOGLEVEL
+ {
+ DEBUG,
+ INFO
+ }
}
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 0a9d99777..93f6db111 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -5,6 +5,7 @@ using System.Text.Json.Serialization;
using System.Windows;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Infrastructure.Hotkey;
+using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;
@@ -199,7 +200,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
};
- public string LogLevel { get; set; } = "info";
+ [JsonConverter(typeof(JsonStringEnumConverter))]
+ public LOGLEVEL LogLevel { get; set; } = LOGLEVEL.INFO;
///
/// when false Alphabet static service will always return empty results
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 6ec0424b8..ec4bb8dc6 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -124,15 +124,11 @@ namespace Flow.Launcher
switch (_settings.LogLevel)
{
- case "debug":
+ case LOGLEVEL.DEBUG:
Log.UseDebugLogLevel();
break;
- case "info":
- Log.UseInfoLogLevel();
- break;
default:
- Log.Error(nameof(Flow.Launcher.App), "Unrecognized log level");
- Log.UseDebugLogLevel();
+ Log.UseInfoLogLevel();
break;
}
From 05ff797613c952aedde47a1cfc55efe924ab6682 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 12:26:29 +0800
Subject: [PATCH 23/36] Use one function to set log level
---
Flow.Launcher.Infrastructure/Logger/Log.cs | 22 +++++++++++++++++-----
Flow.Launcher/App.xaml.cs | 12 ++----------
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/Logger/Log.cs b/Flow.Launcher.Infrastructure/Logger/Log.cs
index 2f368ac0c..7f847e287 100644
--- a/Flow.Launcher.Infrastructure/Logger/Log.cs
+++ b/Flow.Launcher.Infrastructure/Logger/Log.cs
@@ -63,16 +63,28 @@ namespace Flow.Launcher.Infrastructure.Logger
LogManager.Configuration = configuration;
}
- public static void UseDebugLogLevel()
+ public static void SetLogLevel(LOGLEVEL level)
{
- LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
- Info(nameof(Logger), "Using log level: DEBUG.");
+ switch (level)
+ {
+ case LOGLEVEL.DEBUG:
+ UseDebugLogLevel();
+ break;
+ default:
+ UseInfoLogLevel();
+ break;
+ }
+ Info(nameof(Logger), $"Using log level: {level}.");
}
- public static void UseInfoLogLevel()
+ private static void UseDebugLogLevel()
+ {
+ LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
+ }
+
+ private static void UseInfoLogLevel()
{
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Info, LogLevel.Fatal);
- Info(nameof(Logger), "Using log level: INFO.");
}
private static void LogFaultyFormat(string message)
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index ec4bb8dc6..ab68cf426 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -112,6 +112,8 @@ namespace Flow.Launcher
{
await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
{
+ Log.SetLogLevel(_settings.LogLevel);
+
Ioc.Default.GetRequiredService().PreStartCleanUpAfterPortabilityUpdate();
Log.Info("|App.OnStartup|Begin Flow Launcher startup ----------------------------------------------------");
@@ -122,16 +124,6 @@ namespace Flow.Launcher
var imageLoadertask = ImageLoader.InitializeAsync();
- switch (_settings.LogLevel)
- {
- case LOGLEVEL.DEBUG:
- Log.UseDebugLogLevel();
- break;
- default:
- Log.UseInfoLogLevel();
- break;
- }
-
AbstractPluginEnvironment.PreStartPluginExecutablePathUpdate(_settings);
// TODO: Clean InternationalizationManager.Instance and InternationalizationManager.Instance.GetTranslation in future
From 66bf04642a6d9857dd2c91e23a0c5385b4ccddcc Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 12:33:26 +0800
Subject: [PATCH 24/36] Add log level change to general settings page
---
Flow.Launcher/Languages/en.xaml | 3 +++
.../SettingsPaneGeneralViewModel.cs | 22 +++++++++++++++++++
.../Views/SettingsPaneGeneral.xaml | 8 +++++++
3 files changed, 33 insertions(+)
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 058a51ae3..2ead21cf5 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -104,6 +104,9 @@
Always Preview
Always open preview panel when Flow activates. Press {0} to toggle preview.
Shadow effect is not allowed while current theme has blur effect enabled
+ Log level
+ Debug
+ Info
Search Plugin
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
index dddaa99d4..e4f88432a 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
@@ -7,6 +7,7 @@ using Flow.Launcher.Core;
using Flow.Launcher.Core.Configuration;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
+using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;
@@ -31,6 +32,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public class SearchWindowAlignData : DropdownDataGeneric { }
public class SearchPrecisionData : DropdownDataGeneric { }
public class LastQueryModeData : DropdownDataGeneric { }
+ public class LogLevelData : DropdownDataGeneric { }
public bool StartFlowLauncherOnSystemStartup
{
@@ -143,12 +145,16 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public List LastQueryModes { get; } =
DropdownDataGeneric.GetValues("LastQuery");
+ public List LogLevels { get; } =
+ DropdownDataGeneric.GetValues("LogLevel");
+
private void UpdateEnumDropdownLocalizations()
{
DropdownDataGeneric.UpdateLabels(SearchWindowScreens);
DropdownDataGeneric.UpdateLabels(SearchWindowAligns);
DropdownDataGeneric.UpdateLabels(SearchPrecisionScores);
DropdownDataGeneric.UpdateLabels(LastQueryModes);
+ DropdownDataGeneric.UpdateLabels(LogLevels);
}
public string Language
@@ -216,6 +222,22 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
}
}
+ public LOGLEVEL LogLevel
+ {
+ get => Settings.LogLevel;
+ set
+ {
+ if (Settings.LogLevel != value)
+ {
+ Settings.LogLevel = value;
+
+ Log.SetLogLevel(value);
+
+ UpdateEnumDropdownLocalizations();
+ }
+ }
+ }
+
[RelayCommand]
private void SelectPython()
{
diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
index a80e618e8..814eda16b 100644
--- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
+++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
@@ -278,6 +278,14 @@
SelectedValue="{Binding Language}"
SelectedValuePath="LanguageCode" />
+
+
+
+
From b2dc128699fa0365dde4275312d0862bdcf00e24 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 18:39:14 +0800
Subject: [PATCH 25/36] Use dependency injection to fix issue
---
.../Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 52 +++++++++++--------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 3ea90197d..453959ac3 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
+using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Core.Resource;
+using Flow.Launcher.Infrastructure.UserSettings;
namespace Flow.Launcher.Plugin.Sys
{
@@ -10,15 +11,25 @@ namespace Flow.Launcher.Plugin.Sys
{
public const string Keyword = "fltheme";
- private readonly PluginInitContext context;
+ private readonly Settings _settings;
+ private readonly Theme _theme;
+ private readonly PluginInitContext _context;
+
private IEnumerable themes;
public ThemeSelector(PluginInitContext context)
{
- this.context = context;
+ _context = context;
+ _theme = Ioc.Default.GetRequiredService();
+ _settings = Ioc.Default.GetRequiredService();
context.API.VisibilityChanged += OnVisibilityChanged;
}
+ ~ThemeSelector()
+ {
+ Dispose(false);
+ }
+
public List Query(Query query)
{
if (query.IsReQuery)
@@ -31,34 +42,34 @@ namespace Flow.Launcher.Plugin.Sys
if (string.IsNullOrWhiteSpace(search))
{
return themes.Select(CreateThemeResult)
- .OrderBy(x => x.Title)
- .ToList();
+ .OrderBy(x => x.Title)
+ .ToList();
}
- return themes.Select(theme => (theme, matchResult: context.API.FuzzySearch(search, theme)))
- .Where(x => x.matchResult.IsSearchPrecisionScoreMet())
- .Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
- .OrderBy(x => x.Title)
- .ToList();
+ return themes.Select(theme => (theme, matchResult: _context.API.FuzzySearch(search, theme)))
+ .Where(x => x.matchResult.IsSearchPrecisionScoreMet())
+ .Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
+ .OrderBy(x => x.Title)
+ .ToList();
}
private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs args)
{
- if (args.IsVisible && !context.CurrentPluginMetadata.Disabled)
+ if (args.IsVisible && !_context.CurrentPluginMetadata.Disabled)
{
LoadThemes();
}
}
private void LoadThemes()
- => themes = ThemeManager.Instance.LoadAvailableThemes().Select(x => x.FileNameWithoutExtension);
+ => themes = _theme.LoadAvailableThemes().Select(x => x.FileNameWithoutExtension);
- private static Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
+ private Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
- private static Result CreateThemeResult(string theme, int score, IList highlightData)
+ private Result CreateThemeResult(string theme, int score, IList highlightData)
{
string title;
- if (theme == ThemeManager.Instance.Settings.Theme)
+ if (theme == _settings.Theme)
{
title = $"{theme} ★";
score = 2000;
@@ -76,7 +87,7 @@ namespace Flow.Launcher.Plugin.Sys
Score = score,
Action = c =>
{
- ThemeManager.Instance.ChangeTheme(theme);
+ _theme.ChangeTheme(theme);
return true;
}
};
@@ -90,19 +101,16 @@ namespace Flow.Launcher.Plugin.Sys
if (disposing)
{
// Dispose managed resources
- if (context?.API != null)
+ if (_context?.API != null)
{
- context.API.VisibilityChanged -= OnVisibilityChanged;
+ _context.API.VisibilityChanged -= OnVisibilityChanged;
}
}
// Free unmanaged resources
disposed = true;
}
}
- ~ThemeSelector()
- {
- Dispose(false);
- }
+
public void Dispose()
{
Dispose(true);
From 59fbef1d7866b1cfa56871f9718ba53eb81eb44a Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 18:45:57 +0800
Subject: [PATCH 26/36] Use public current theme
---
Flow.Launcher.Core/Resource/Theme.cs | 3 ++-
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 5 +----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs
index 4deea1f66..cda125a39 100644
--- a/Flow.Launcher.Core/Resource/Theme.cs
+++ b/Flow.Launcher.Core/Resource/Theme.cs
@@ -12,7 +12,6 @@ using System.Windows.Shell;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
-using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Core.Resource
@@ -35,6 +34,8 @@ namespace Flow.Launcher.Core.Resource
private string DirectoryPath => Path.Combine(Constant.ProgramDirectory, Folder);
private string UserDirectoryPath => Path.Combine(DataLocation.DataDirectory(), Folder);
+ public string CurrentTheme => _settings.Theme;
+
public bool BlurEnabled { get; set; }
private double mainWindowWidth;
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 453959ac3..82c06c280 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Core.Resource;
-using Flow.Launcher.Infrastructure.UserSettings;
namespace Flow.Launcher.Plugin.Sys
{
@@ -11,7 +10,6 @@ namespace Flow.Launcher.Plugin.Sys
{
public const string Keyword = "fltheme";
- private readonly Settings _settings;
private readonly Theme _theme;
private readonly PluginInitContext _context;
@@ -21,7 +19,6 @@ namespace Flow.Launcher.Plugin.Sys
{
_context = context;
_theme = Ioc.Default.GetRequiredService();
- _settings = Ioc.Default.GetRequiredService();
context.API.VisibilityChanged += OnVisibilityChanged;
}
@@ -69,7 +66,7 @@ namespace Flow.Launcher.Plugin.Sys
private Result CreateThemeResult(string theme, int score, IList highlightData)
{
string title;
- if (theme == _settings.Theme)
+ if (theme == _theme.CurrentTheme)
{
title = $"{theme} ★";
score = 2000;
From 9395b89a54b143768528a3f522fed75b3e06d6c3 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 18:53:00 +0800
Subject: [PATCH 27/36] Make default score larger
---
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 82c06c280..9cf6a0dd3 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -74,6 +74,8 @@ namespace Flow.Launcher.Plugin.Sys
else
{
title = theme;
+ // Set them to 1000 so that they are higher than other non-theme records
+ score = 1000;
}
return new Result
From 468c0b23c053c6d0320c8d066a808f268dd83232 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 18:54:43 +0800
Subject: [PATCH 28/36] Change ico & glyph
---
Plugins/Flow.Launcher.Plugin.Sys/Main.cs | 4 ++--
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
index 4aa7c5438..c41e159dc 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
@@ -464,8 +464,8 @@ namespace Flow.Launcher.Plugin.Sys
{
Title = "Set Flow Launcher Theme",
SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_theme_selector"),
- IcoPath = "Images\\theme_selector.png",
- Glyph = new GlyphInfo("/Resources/#Segoe Fluent Icons", "\ue790"),
+ IcoPath = "Images\\app.png",
+ Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\ue7fc"),
Action = c =>
{
context.API.ChangeQuery($"{ThemeSelector.Keyword} ");
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 9cf6a0dd3..658c3b0a8 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -82,6 +82,7 @@ namespace Flow.Launcher.Plugin.Sys
{
Title = title,
TitleHighlightData = highlightData,
+ IcoPath = "Images\\theme_selector.png",
Glyph = new GlyphInfo("/Resources/#Segoe Fluent Icons", "\ue790"),
Score = score,
Action = c =>
From bad304b38f25aeddbb20a2c57a8d13704e99230f Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 21:50:39 +0800
Subject: [PATCH 29/36] Query themes every time
---
Plugins/Flow.Launcher.Plugin.Sys/Main.cs | 8 +--
.../Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 54 ++-----------------
2 files changed, 5 insertions(+), 57 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
index c41e159dc..28747cc7c 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
@@ -7,7 +7,6 @@ using System.Windows;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
-using Flow.Launcher.Plugin.SharedCommands;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Security;
@@ -17,7 +16,7 @@ using Control = System.Windows.Controls.Control;
namespace Flow.Launcher.Plugin.Sys
{
- public class Main : IPlugin, ISettingProvider, IPluginI18n, IDisposable
+ public class Main : IPlugin, ISettingProvider, IPluginI18n
{
private PluginInitContext context;
private ThemeSelector themeSelector;
@@ -486,10 +485,5 @@ namespace Flow.Launcher.Plugin.Sys
{
return context.API.GetTranslation("flowlauncher_plugin_sys_plugin_description");
}
-
- public void Dispose()
- {
- themeSelector.Dispose();
- }
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 658c3b0a8..bbc45c180 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -1,38 +1,26 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Core.Resource;
namespace Flow.Launcher.Plugin.Sys
{
- public class ThemeSelector : IDisposable
+ public class ThemeSelector
{
public const string Keyword = "fltheme";
private readonly Theme _theme;
private readonly PluginInitContext _context;
- private IEnumerable themes;
-
public ThemeSelector(PluginInitContext context)
{
_context = context;
_theme = Ioc.Default.GetRequiredService();
- context.API.VisibilityChanged += OnVisibilityChanged;
- }
-
- ~ThemeSelector()
- {
- Dispose(false);
}
public List Query(Query query)
{
- if (query.IsReQuery)
- {
- LoadThemes();
- }
+ var themes = _theme.LoadAvailableThemes().Select(x => x.FileNameWithoutExtension);
string search = query.SecondToEndSearch;
@@ -50,17 +38,6 @@ namespace Flow.Launcher.Plugin.Sys
.ToList();
}
- private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs args)
- {
- if (args.IsVisible && !_context.CurrentPluginMetadata.Disabled)
- {
- LoadThemes();
- }
- }
-
- private void LoadThemes()
- => themes = _theme.LoadAvailableThemes().Select(x => x.FileNameWithoutExtension);
-
private Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
private Result CreateThemeResult(string theme, int score, IList highlightData)
@@ -69,6 +46,7 @@ namespace Flow.Launcher.Plugin.Sys
if (theme == _theme.CurrentTheme)
{
title = $"{theme} ★";
+ // Set current theme to the top
score = 2000;
}
else
@@ -92,29 +70,5 @@ namespace Flow.Launcher.Plugin.Sys
}
};
}
-
- private bool disposed;
- protected virtual void Dispose(bool disposing)
- {
- if (!disposed)
- {
- if (disposing)
- {
- // Dispose managed resources
- if (_context?.API != null)
- {
- _context.API.VisibilityChanged -= OnVisibilityChanged;
- }
- }
- // Free unmanaged resources
- disposed = true;
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
}
}
From 94774b25589f491114679ea60c4297dd265acb82 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 21:59:04 +0800
Subject: [PATCH 30/36] Requery and do not close window
---
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index bbc45c180..70aa74d77 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -66,7 +66,8 @@ namespace Flow.Launcher.Plugin.Sys
Action = c =>
{
_theme.ChangeTheme(theme);
- return true;
+ _context.API.ReQuery();
+ return false;
}
};
}
From d099a392c5cbf91157587791fac2e37b2139f26e Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Wed, 12 Mar 2025 22:23:52 +0800
Subject: [PATCH 31/36] Fix theme change drop shadow effect issue & Add theme
description
---
.../Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 86 ++++++++++++++++---
1 file changed, 74 insertions(+), 12 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 70aa74d77..066f62c4e 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -2,6 +2,7 @@
using System.Linq;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Core.Resource;
+using Flow.Launcher.Infrastructure.UserSettings;
namespace Flow.Launcher.Plugin.Sys
{
@@ -9,9 +10,56 @@ namespace Flow.Launcher.Plugin.Sys
{
public const string Keyword = "fltheme";
+ private readonly Settings _settings;
private readonly Theme _theme;
private readonly PluginInitContext _context;
+ #region Theme Selection
+
+ // Theme select codes from SettingsPaneThemeViewModel.cs
+
+ private Theme.ThemeData _selectedTheme;
+ private Theme.ThemeData SelectedTheme
+ {
+ get => _selectedTheme ??= Themes.Find(v => v.FileNameWithoutExtension == _theme.CurrentTheme);
+ set
+ {
+ _selectedTheme = value;
+ _theme.ChangeTheme(value.FileNameWithoutExtension);
+
+ if (_theme.BlurEnabled && _settings.UseDropShadowEffect)
+ DropShadowEffect = false;
+ }
+ }
+
+ private List Themes => _theme.LoadAvailableThemes();
+
+ private bool DropShadowEffect
+ {
+ get => _settings.UseDropShadowEffect;
+ set
+ {
+ if (_theme.BlurEnabled && value)
+ {
+ _context.API.ShowMsgBox(_context.API.GetTranslation("shadowEffectNotAllowed"));
+ return;
+ }
+
+ if (value)
+ {
+ _theme.AddDropShadowEffectToCurrentTheme();
+ }
+ else
+ {
+ _theme.RemoveDropShadowEffectFromCurrentTheme();
+ }
+
+ _settings.UseDropShadowEffect = value;
+ }
+ }
+
+ #endregion
+
public ThemeSelector(PluginInitContext context)
{
_context = context;
@@ -20,52 +68,66 @@ namespace Flow.Launcher.Plugin.Sys
public List Query(Query query)
{
- var themes = _theme.LoadAvailableThemes().Select(x => x.FileNameWithoutExtension);
-
- string search = query.SecondToEndSearch;
-
+ var search = query.SecondToEndSearch;
if (string.IsNullOrWhiteSpace(search))
{
- return themes.Select(CreateThemeResult)
+ return Themes.Select(CreateThemeResult)
.OrderBy(x => x.Title)
.ToList();
}
- return themes.Select(theme => (theme, matchResult: _context.API.FuzzySearch(search, theme)))
+ return Themes.Select(theme => (theme, matchResult: _context.API.FuzzySearch(search, theme.Name)))
.Where(x => x.matchResult.IsSearchPrecisionScoreMet())
.Select(x => CreateThemeResult(x.theme, x.matchResult.Score, x.matchResult.MatchData))
.OrderBy(x => x.Title)
.ToList();
}
- private Result CreateThemeResult(string theme) => CreateThemeResult(theme, 0, null);
+ private Result CreateThemeResult(Theme.ThemeData theme) => CreateThemeResult(theme, 0, null);
- private Result CreateThemeResult(string theme, int score, IList highlightData)
+ private Result CreateThemeResult(Theme.ThemeData theme, int score, IList highlightData)
{
+ string themeName = theme.Name;
string title;
- if (theme == _theme.CurrentTheme)
+ if (theme == SelectedTheme)
{
- title = $"{theme} ★";
+ title = $"{theme.Name} ★";
// Set current theme to the top
score = 2000;
}
else
{
- title = theme;
+ title = theme.Name;
// Set them to 1000 so that they are higher than other non-theme records
score = 1000;
}
+ string description = string.Empty;
+ if (theme.IsDark == true)
+ {
+ description += _context.API.GetTranslation("TypeIsDarkToolTip");
+ if (theme.HasBlur == true)
+ {
+ description += "";
+ description += _context.API.GetTranslation("TypeHasBlurToolTip");
+ }
+ }
+ else if (theme.HasBlur == true)
+ {
+ description += _context.API.GetTranslation("TypeHasBlurToolTip");
+ }
+
return new Result
{
Title = title,
TitleHighlightData = highlightData,
+ SubTitle = description,
IcoPath = "Images\\theme_selector.png",
Glyph = new GlyphInfo("/Resources/#Segoe Fluent Icons", "\ue790"),
Score = score,
Action = c =>
{
- _theme.ChangeTheme(theme);
+ SelectedTheme = theme;
_context.API.ReQuery();
return false;
}
From b2f8ad9fb9bd6b25f94b029856e39f66ca2b2147 Mon Sep 17 00:00:00 2001
From: Odotocodot <48138990+Odotocodot@users.noreply.github.com>
Date: Wed, 12 Mar 2025 16:02:42 +0000
Subject: [PATCH 32/36] Fix null exception
---
Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 066f62c4e..24eff0017 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -64,6 +64,7 @@ namespace Flow.Launcher.Plugin.Sys
{
_context = context;
_theme = Ioc.Default.GetRequiredService();
+ _settings = Ioc.Default.GetRequiredService();
}
public List Query(Query query)
From 84cd1a84ac00dd301eb638f9c2293906efe30076 Mon Sep 17 00:00:00 2001
From: Odotocodot <48138990+Odotocodot@users.noreply.github.com>
Date: Wed, 12 Mar 2025 16:05:50 +0000
Subject: [PATCH 33/36] Remove extra code
---
.../Flow.Launcher.Plugin.Sys/ThemeSelector.cs | 41 ++++---------------
1 file changed, 9 insertions(+), 32 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
index 24eff0017..38619cbbc 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs
@@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.Sys
#region Theme Selection
- // Theme select codes from SettingsPaneThemeViewModel.cs
+ // Theme select codes simplified from SettingsPaneThemeViewModel.cs
private Theme.ThemeData _selectedTheme;
private Theme.ThemeData SelectedTheme
@@ -28,36 +28,15 @@ namespace Flow.Launcher.Plugin.Sys
_theme.ChangeTheme(value.FileNameWithoutExtension);
if (_theme.BlurEnabled && _settings.UseDropShadowEffect)
- DropShadowEffect = false;
+ {
+ _theme.RemoveDropShadowEffectFromCurrentTheme();
+ _settings.UseDropShadowEffect = false;
+ }
}
}
private List Themes => _theme.LoadAvailableThemes();
- private bool DropShadowEffect
- {
- get => _settings.UseDropShadowEffect;
- set
- {
- if (_theme.BlurEnabled && value)
- {
- _context.API.ShowMsgBox(_context.API.GetTranslation("shadowEffectNotAllowed"));
- return;
- }
-
- if (value)
- {
- _theme.AddDropShadowEffectToCurrentTheme();
- }
- else
- {
- _theme.RemoveDropShadowEffectFromCurrentTheme();
- }
-
- _settings.UseDropShadowEffect = value;
- }
- }
-
#endregion
public ThemeSelector(PluginInitContext context)
@@ -107,14 +86,12 @@ namespace Flow.Launcher.Plugin.Sys
if (theme.IsDark == true)
{
description += _context.API.GetTranslation("TypeIsDarkToolTip");
- if (theme.HasBlur == true)
- {
- description += "";
- description += _context.API.GetTranslation("TypeHasBlurToolTip");
- }
}
- else if (theme.HasBlur == true)
+
+ if (theme.HasBlur == true)
{
+ if (!string.IsNullOrEmpty(description))
+ description += " ";
description += _context.API.GetTranslation("TypeHasBlurToolTip");
}
From e8be131221a55d84a4d60fd5680c4006ab5f096f Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Thu, 13 Mar 2025 12:53:26 +0800
Subject: [PATCH 34/36] Move log level to about page
---
.../ViewModels/SettingsPaneAboutViewModel.cs | 27 ++++++++++++++++++-
.../SettingsPaneGeneralViewModel.cs | 23 ----------------
.../SettingPages/Views/SettingsPaneAbout.xaml | 8 ++++++
.../Views/SettingsPaneGeneral.xaml | 8 ------
4 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
index ade650284..6b44be7c1 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
@@ -8,6 +8,7 @@ using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Infrastructure;
+using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
@@ -45,10 +46,35 @@ public partial class SettingsPaneAboutViewModel : BaseModel
_settings.ActivateTimes
);
+ public class LogLevelData : DropdownDataGeneric { }
+
+ public List LogLevels { get; } =
+ DropdownDataGeneric.GetValues("LogLevel");
+
+ public LOGLEVEL LogLevel
+ {
+ get => _settings.LogLevel;
+ set
+ {
+ if (_settings.LogLevel != value)
+ {
+ _settings.LogLevel = value;
+
+ Log.SetLogLevel(value);
+ }
+ }
+ }
+
public SettingsPaneAboutViewModel(Settings settings, Updater updater)
{
_settings = settings;
_updater = updater;
+ UpdateEnumDropdownLocalizations();
+ }
+
+ private void UpdateEnumDropdownLocalizations()
+ {
+ DropdownDataGeneric.UpdateLabels(LogLevels);
}
[RelayCommand]
@@ -138,5 +164,4 @@ public partial class SettingsPaneAboutViewModel : BaseModel
return "0 B";
}
-
}
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
index e4f88432a..de4f158ad 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
@@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Windows.Forms;
using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core;
using Flow.Launcher.Core.Configuration;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
-using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;
@@ -32,7 +30,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public class SearchWindowAlignData : DropdownDataGeneric { }
public class SearchPrecisionData : DropdownDataGeneric { }
public class LastQueryModeData : DropdownDataGeneric { }
- public class LogLevelData : DropdownDataGeneric { }
public bool StartFlowLauncherOnSystemStartup
{
@@ -145,16 +142,12 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public List LastQueryModes { get; } =
DropdownDataGeneric.GetValues("LastQuery");
- public List LogLevels { get; } =
- DropdownDataGeneric.GetValues("LogLevel");
-
private void UpdateEnumDropdownLocalizations()
{
DropdownDataGeneric.UpdateLabels(SearchWindowScreens);
DropdownDataGeneric.UpdateLabels(SearchWindowAligns);
DropdownDataGeneric.UpdateLabels(SearchPrecisionScores);
DropdownDataGeneric.UpdateLabels(LastQueryModes);
- DropdownDataGeneric.UpdateLabels(LogLevels);
}
public string Language
@@ -222,22 +215,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
}
}
- public LOGLEVEL LogLevel
- {
- get => Settings.LogLevel;
- set
- {
- if (Settings.LogLevel != value)
- {
- Settings.LogLevel = value;
-
- Log.SetLogLevel(value);
-
- UpdateEnumDropdownLocalizations();
- }
- }
- }
-
[RelayCommand]
private void SelectPython()
{
diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
index e33fee02b..3ca8e163a 100644
--- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
+++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
@@ -123,6 +123,14 @@
+
+
+
+
-
-
-
-
From f24d64afec925923a81b1e2735f06be761e6d5de Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Thu, 13 Mar 2025 13:06:25 +0800
Subject: [PATCH 35/36] Add log level glyph
---
Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
index 3ca8e163a..75c513411 100644
--- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
+++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
@@ -123,7 +123,7 @@
-
+
Date: Thu, 13 Mar 2025 13:13:14 +0800
Subject: [PATCH 36/36] Fix strings
---
Flow.Launcher/Languages/en.xaml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 2ead21cf5..a3f87cd30 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -104,9 +104,6 @@
Always Preview
Always open preview panel when Flow activates. Press {0} to toggle preview.
Shadow effect is not allowed while current theme has blur effect enabled
- Log level
- Debug
- Info
Search Plugin
@@ -303,6 +300,9 @@
User Data Location
User settings and installed plugins are saved in the user data folder. This location may vary depending on whether it's in portable mode or not.
Open Folder
+ Log Level
+ Debug
+ Info
Select File Manager