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