From 6e4d9a5e61c577ae684c29f6513e22b2bb339a1a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 11:10:16 +0800 Subject: [PATCH 001/138] Remove useless blank lines --- Flow.Launcher.Core/Plugin/PluginManager.cs | 1 - Flow.Launcher.Plugin/Query.cs | 1 - Flow.Launcher/ViewModel/MainViewModel.cs | 2 -- 3 files changed, 4 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 5c4eaa1da..b1f397ea2 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -229,7 +229,6 @@ namespace Flow.Launcher.Core.Plugin if (!NonGlobalPlugins.ContainsKey(query.ActionKeyword)) return GlobalPlugins; - var plugin = NonGlobalPlugins[query.ActionKeyword]; return new List { diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index e182491c2..ab3c8cfeb 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -43,7 +43,6 @@ namespace Flow.Launcher.Plugin /// public const string ActionKeywordSeparator = ";"; - /// /// Wildcard action keyword. Plugins using this value will be queried on every search. /// diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 5c3251bfc..075471367 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1118,7 +1118,6 @@ namespace Flow.Launcher.ViewModel SearchIconVisibility = Visibility.Visible; } - if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign) { // Wait 45 millisecond for query change in global query @@ -1145,7 +1144,6 @@ namespace Flow.Launcher.ViewModel true => Task.CompletedTask }).ToArray(); - try { // Check the code, WhenAll will translate all type of IEnumerable or Collection to Array, so make an array at first From 8f6bed45e4f9305110f2ffc9aac47f827c7d84b4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 12:23:31 +0800 Subject: [PATCH 002/138] Remove useless * keywords --- Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 4eb6bb83b..89eaa657d 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -2,10 +2,7 @@ "ID": "572be03c74c642baae319fc283e561a8", "ActionKeywords": [ "*", - "doc:", - "*", - "*", - "*" + "doc:" ], "Name": "Explorer", "Description": "Find and manage files and folders via Windows Search or Everything", From e1f1b97b7e158d015f122e02f393e6d72ae08697 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 12:27:38 +0800 Subject: [PATCH 003/138] Support allow modify action keywords & WebSearch does not let user change its keywords --- Flow.Launcher.Plugin/PluginMetadata.cs | 2 ++ Flow.Launcher/ViewModel/PluginViewModel.cs | 2 +- Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Plugin/PluginMetadata.cs b/Flow.Launcher.Plugin/PluginMetadata.cs index b4e06913e..14a720203 100644 --- a/Flow.Launcher.Plugin/PluginMetadata.cs +++ b/Flow.Launcher.Plugin/PluginMetadata.cs @@ -34,6 +34,8 @@ namespace Flow.Launcher.Plugin public List ActionKeywords { get; set; } + public bool AllowModifyActionKeywords { get; set; } = true; + public string IcoPath { get; set;} public override string ToString() diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index a46b98d64..4b628f96e 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -100,7 +100,7 @@ namespace Flow.Launcher.ViewModel : null; private ImageSource _image = ImageLoader.MissingImage; - public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed; + public Visibility ActionKeywordsVisibility => PluginPair.Metadata.AllowModifyActionKeywords ? Visibility.Visible : Visibility.Collapsed; public string InitilizaTime => PluginPair.Metadata.InitTime + "ms"; public string QueryTime => PluginPair.Metadata.AvgQueryTime + "ms"; public string Version => InternationalizationManager.Instance.GetTranslation("plugin_query_version") + " " + PluginPair.Metadata.Version; diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json index 6b6792ad3..1fc9967fc 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json @@ -23,6 +23,7 @@ "yahoo", "bd" ], + "AllowModifyActionKeywords": false, "Name": "Web Searches", "Description": "Provide the web search ability", "Author": "qianlifeng", From abfeee1423a011229ec6cd9dd7e85dddc2a90ac6 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 12:59:56 +0800 Subject: [PATCH 004/138] Support multiple action keywords --- Flow.Launcher.Core/Plugin/PluginManager.cs | 29 +++++++++++++++++----- Flow.Launcher.Plugin/Query.cs | 4 +-- Flow.Launcher/ActionKeywords.xaml.cs | 15 +++++++---- Flow.Launcher/ViewModel/PluginViewModel.cs | 7 +++--- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index b1f397ea2..8c62c2f02 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -340,7 +340,12 @@ namespace Flow.Launcher.Core.Plugin return results; } - public static bool ActionKeywordRegistered(string actionKeyword) + public static bool ActionKeywordRegistered(IReadOnlyList actionKeywords) + { + return actionKeywords.Any(ActionKeywordRegistered); + } + + private static bool ActionKeywordRegistered(string actionKeyword) { // this method is only checking for action keywords (defined as not '*') registration // hence the actionKeyword != Query.GlobalPluginWildcardSign logic @@ -385,19 +390,31 @@ namespace Flow.Launcher.Core.Plugin if (oldActionkeyword != Query.GlobalPluginWildcardSign) NonGlobalPlugins.Remove(oldActionkeyword); - plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); } - public static void ReplaceActionKeyword(string id, string oldActionKeyword, string newActionKeyword) + public static void ReplaceActionKeyword(string id, IReadOnlyList oldActionKeyword, IReadOnlyList newActionKeyword) { - if (oldActionKeyword != newActionKeyword) + if (CheckActionKeywordChanged(oldActionKeyword, newActionKeyword)) { - AddActionKeyword(id, newActionKeyword); - RemoveActionKeyword(id, oldActionKeyword); + foreach (var actionKeyword in newActionKeyword) + { + AddActionKeyword(id, actionKeyword); + } + foreach (var actionKeyword in oldActionKeyword) + { + RemoveActionKeyword(id, actionKeyword); + } } } + private static bool CheckActionKeywordChanged(IReadOnlyList oldActionKeyword, IReadOnlyList newActionKeyword) + { + if (oldActionKeyword.Count != newActionKeyword.Count) + return true; + return oldActionKeyword.Where((t, i) => t != newActionKeyword[i]).Any(); + } + private static string GetContainingFolderPathAfterUnzip(string unzippedParentFolderPath) { var unzippedFolderCount = Directory.GetDirectories(unzippedParentFolderPath).Length; diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index ab3c8cfeb..15b2dd171 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -39,9 +39,9 @@ namespace Flow.Launcher.Plugin public const string TermSeparator = " "; /// - /// User can set multiple action keywords seperated by ';' + /// User can set multiple action keywords seperated by whitespace /// - public const string ActionKeywordSeparator = ";"; + public const string ActionKeywordSeparator = TermSeparator; /// /// Wildcard action keyword. Plugins using this value will be queried on every search. diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index ba47a4ded..4a6bd10a8 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -3,6 +3,7 @@ using Flow.Launcher.Core.Resource; using Flow.Launcher.Plugin; using Flow.Launcher.ViewModel; using Flow.Launcher.Core; +using System.Linq; namespace Flow.Launcher { @@ -32,13 +33,17 @@ namespace Flow.Launcher private void btnDone_OnClick(object sender, RoutedEventArgs _) { - var oldActionKeyword = plugin.Metadata.ActionKeywords[0]; - var newActionKeyword = tbAction.Text.Trim(); - newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*"; + var oldActionKeywords = plugin.Metadata.ActionKeywords; + + var newActionKeywords = tbAction.Text.Split(Query.ActionKeywordSeparator).ToList(); + newActionKeywords.RemoveAll(string.IsNullOrEmpty); + newActionKeywords = newActionKeywords.Distinct().ToList(); + + newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign }; - if (!PluginViewModel.IsActionKeywordRegistered(newActionKeyword)) + if (!PluginViewModel.IsActionKeywordRegistered(newActionKeywords)) { - pluginViewModel.ChangeActionKeyword(newActionKeyword, oldActionKeyword); + pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords); Close(); } else diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 4b628f96e..748490c47 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -8,6 +8,7 @@ using System.Windows.Controls; using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Core.Resource; using Flow.Launcher.Resources.Controls; +using System.Collections.Generic; namespace Flow.Launcher.ViewModel { @@ -109,9 +110,9 @@ namespace Flow.Launcher.ViewModel public int Priority => PluginPair.Metadata.Priority; public Infrastructure.UserSettings.Plugin PluginSettingsObject { get; set; } - public void ChangeActionKeyword(string newActionKeyword, string oldActionKeyword) + public void ChangeActionKeyword(IReadOnlyList newActionKeywords, IReadOnlyList oldActionKeywords) { - PluginManager.ReplaceActionKeyword(PluginPair.Metadata.ID, oldActionKeyword, newActionKeyword); + PluginManager.ReplaceActionKeyword(PluginPair.Metadata.ID, oldActionKeywords, newActionKeywords); OnPropertyChanged(nameof(ActionKeywordsText)); } @@ -150,7 +151,7 @@ namespace Flow.Launcher.ViewModel PluginManager.API.ShowMainWindow(); } - public static bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword); + public static bool IsActionKeywordRegistered(IReadOnlyList newActionKeywords) => PluginManager.ActionKeywordRegistered(newActionKeywords); [RelayCommand] private void SetActionKeywords() From d9ba38b3221174996201f8df2b1a93a9000e00e5 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 13:09:19 +0800 Subject: [PATCH 005/138] Fix issue that plugin cannot update ActionKeyword after changing its action keywords --- Flow.Launcher.Core/Plugin/PluginManager.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 8c62c2f02..e4ecf0f40 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -405,6 +405,17 @@ namespace Flow.Launcher.Core.Plugin { RemoveActionKeyword(id, actionKeyword); } + + // Update action keyword in plugin metadata + var plugin = GetPluginForId(id); + if (newActionKeyword.Count > 0) + { + plugin.Metadata.ActionKeyword = newActionKeyword[0]; + } + else + { + plugin.Metadata.ActionKeyword = string.Empty; + } } } From f999b97de1e2a57dd11a7b8fe1ab39194936b865 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 13:25:31 +0800 Subject: [PATCH 006/138] Fix build issue --- Flow.Launcher.Core/Plugin/PluginManager.cs | 46 +++++++++++++++---- .../SearchSourceSetting.xaml.cs | 4 +- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index e4ecf0f40..c8f78767c 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -342,10 +342,17 @@ namespace Flow.Launcher.Core.Plugin public static bool ActionKeywordRegistered(IReadOnlyList actionKeywords) { - return actionKeywords.Any(ActionKeywordRegistered); + foreach (var actionKeyword in actionKeywords) + { + if (ActionKeywordRegistered(actionKeyword)) + { + return true; + } + } + return false; } - private static bool ActionKeywordRegistered(string actionKeyword) + public static bool ActionKeywordRegistered(string actionKeyword) { // this method is only checking for action keywords (defined as not '*') registration // hence the actionKeyword != Query.GlobalPluginWildcardSign logic @@ -369,6 +376,7 @@ namespace Flow.Launcher.Core.Plugin NonGlobalPlugins[newActionKeyword] = plugin; } + // Update action keywords in plugin metadata plugin.Metadata.ActionKeywords.Add(newActionKeyword); } @@ -390,27 +398,28 @@ namespace Flow.Launcher.Core.Plugin if (oldActionkeyword != Query.GlobalPluginWildcardSign) NonGlobalPlugins.Remove(oldActionkeyword); + // Update action keywords in plugin metadata plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); } - public static void ReplaceActionKeyword(string id, IReadOnlyList oldActionKeyword, IReadOnlyList newActionKeyword) + public static void ReplaceActionKeyword(string id, IReadOnlyList oldActionKeywords, IReadOnlyList newActionKeywords) { - if (CheckActionKeywordChanged(oldActionKeyword, newActionKeyword)) + if (CheckActionKeywordChanged(oldActionKeywords, newActionKeywords)) { - foreach (var actionKeyword in newActionKeyword) + foreach (var actionKeyword in newActionKeywords) { AddActionKeyword(id, actionKeyword); } - foreach (var actionKeyword in oldActionKeyword) + foreach (var actionKeyword in oldActionKeywords) { RemoveActionKeyword(id, actionKeyword); } // Update action keyword in plugin metadata var plugin = GetPluginForId(id); - if (newActionKeyword.Count > 0) + if (newActionKeywords.Count > 0) { - plugin.Metadata.ActionKeyword = newActionKeyword[0]; + plugin.Metadata.ActionKeyword = newActionKeywords[0]; } else { @@ -426,6 +435,27 @@ namespace Flow.Launcher.Core.Plugin return oldActionKeyword.Where((t, i) => t != newActionKeyword[i]).Any(); } + public static void ReplaceActionKeyword(string id, string oldActionKeyword, string newActionKeyword) + { + if (oldActionKeyword != newActionKeyword) + { + AddActionKeyword(id, newActionKeyword); + RemoveActionKeyword(id, oldActionKeyword); + + // Update action keyword in plugin metadata + var plugin = GetPluginForId(id); + var newActionKeywords = plugin.Metadata.ActionKeywords; + if (newActionKeywords.Count > 0) + { + plugin.Metadata.ActionKeyword = newActionKeywords[0]; + } + else + { + plugin.Metadata.ActionKeyword = string.Empty; + } + } + } + private static string GetContainingFolderPathAfterUnzip(string unzippedParentFolderPath) { var unzippedFolderCount = Directory.GetDirectories(unzippedParentFolderPath).Length; diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs index a3e5630c2..f79176f99 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs @@ -80,7 +80,7 @@ namespace Flow.Launcher.Plugin.WebSearch private void AddSearchSource() { var keyword = _searchSource.ActionKeyword; - if (!PluginManager.ActionKeywordRegistered(keyword)) + if (!_context.API.ActionKeywordAssigned(keyword)) { var id = _context.CurrentPluginMetadata.ID; PluginManager.AddActionKeyword(id, keyword); @@ -100,7 +100,7 @@ namespace Flow.Launcher.Plugin.WebSearch { var newKeyword = _searchSource.ActionKeyword; var oldKeyword = _oldSearchSource.ActionKeyword; - if (!PluginManager.ActionKeywordRegistered(newKeyword) || oldKeyword == newKeyword) + if (!_context.API.ActionKeywordAssigned(newKeyword) || oldKeyword == newKeyword) { var id = _context.CurrentPluginMetadata.ID; PluginManager.ReplaceActionKeyword(id, oldKeyword, newKeyword); From 37ad5aa09bb1336ee3db27a913e6d2a51cc314c4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 13:31:46 +0800 Subject: [PATCH 007/138] Fix issue that ActionKeywordRegistered will not exclude old action key --- Flow.Launcher.Core/Plugin/PluginManager.cs | 12 +++++++++--- Flow.Launcher/ActionKeywords.xaml.cs | 3 ++- Flow.Launcher/ViewModel/PluginViewModel.cs | 2 -- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index c8f78767c..d0e6fcab0 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -340,11 +340,11 @@ namespace Flow.Launcher.Core.Plugin return results; } - public static bool ActionKeywordRegistered(IReadOnlyList actionKeywords) + public static bool ActionKeywordRegistered(IReadOnlyList newActionKeywords, IReadOnlyList oldActionKeywords) { - foreach (var actionKeyword in actionKeywords) + foreach (var actionKeyword in newActionKeywords) { - if (ActionKeywordRegistered(actionKeyword)) + if (ActionKeywordRegistered(actionKeyword, oldActionKeywords)) { return true; } @@ -352,6 +352,12 @@ namespace Flow.Launcher.Core.Plugin return false; } + private static bool ActionKeywordRegistered(string actionKeyword, IReadOnlyList oldActionKeywords) + { + if (oldActionKeywords.Contains(actionKeyword)) return false; + return ActionKeywordRegistered(actionKeyword); + } + public static bool ActionKeywordRegistered(string actionKeyword) { // this method is only checking for action keywords (defined as not '*') registration diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index 4a6bd10a8..af6dcfe90 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -4,6 +4,7 @@ using Flow.Launcher.Plugin; using Flow.Launcher.ViewModel; using Flow.Launcher.Core; using System.Linq; +using Flow.Launcher.Core.Plugin; namespace Flow.Launcher { @@ -41,7 +42,7 @@ namespace Flow.Launcher newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign }; - if (!PluginViewModel.IsActionKeywordRegistered(newActionKeywords)) + if (!PluginManager.ActionKeywordRegistered(newActionKeywords, oldActionKeywords)) { pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords); Close(); diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 748490c47..63263c768 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -151,8 +151,6 @@ namespace Flow.Launcher.ViewModel PluginManager.API.ShowMainWindow(); } - public static bool IsActionKeywordRegistered(IReadOnlyList newActionKeywords) => PluginManager.ActionKeywordRegistered(newActionKeywords); - [RelayCommand] private void SetActionKeywords() { From 300d64d66165e4cc302dcf58ce8fe908323135be Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 13:43:53 +0800 Subject: [PATCH 008/138] Remove action keyword first --- Flow.Launcher.Core/Plugin/PluginManager.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index d0e6fcab0..18519c85d 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -412,14 +412,16 @@ namespace Flow.Launcher.Core.Plugin { if (CheckActionKeywordChanged(oldActionKeywords, newActionKeywords)) { + // Fix collection modified while iterating exception + var oldActionKeywordsClone = oldActionKeywords.ToList(); + foreach (var actionKeyword in oldActionKeywordsClone) + { + RemoveActionKeyword(id, actionKeyword); + } foreach (var actionKeyword in newActionKeywords) { AddActionKeyword(id, actionKeyword); } - foreach (var actionKeyword in oldActionKeywords) - { - RemoveActionKeyword(id, actionKeyword); - } // Update action keyword in plugin metadata var plugin = GetPluginForId(id); @@ -445,8 +447,8 @@ namespace Flow.Launcher.Core.Plugin { if (oldActionKeyword != newActionKeyword) { - AddActionKeyword(id, newActionKeyword); RemoveActionKeyword(id, oldActionKeyword); + AddActionKeyword(id, newActionKeyword); // Update action keyword in plugin metadata var plugin = GetPluginForId(id); From cab3eb78fd827283e7511511fba1bce1e8bf58cd Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 13:45:02 +0800 Subject: [PATCH 009/138] Update string resource --- Flow.Launcher/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 4c465d61f..282d0fb47 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -335,7 +335,7 @@ This new Action Keyword is already assigned to another plugin, please choose a different one Success Completed successfully - Enter the action keyword you like to use to start the plugin. Use * if you don't want to specify any, and the plugin will be triggered without any action keywords. + Enter the action keywords you like to use to start the plugin and use whitespace to divide them. Use * if you don't want to specify any, and the plugin will be triggered without any action keywords. Custom Query Hotkey From 414684ce43b78452a544dcb12cef8abd1af9e5ee Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Feb 2025 13:50:44 +0800 Subject: [PATCH 010/138] Replace action keyword function with api --- .../Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs | 2 +- Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs index f79176f99..fa53e5f5a 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs @@ -83,7 +83,7 @@ namespace Flow.Launcher.Plugin.WebSearch if (!_context.API.ActionKeywordAssigned(keyword)) { var id = _context.CurrentPluginMetadata.ID; - PluginManager.AddActionKeyword(id, keyword); + _context.API.AddActionKeyword(id, keyword); _searchSources.Add(_searchSource); diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs index 739bc9d6b..5efe46a9d 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs @@ -40,7 +40,7 @@ namespace Flow.Launcher.Plugin.WebSearch if (result == MessageBoxResult.Yes) { var id = _context.CurrentPluginMetadata.ID; - PluginManager.RemoveActionKeyword(id, selected.ActionKeyword); + _context.API.RemoveActionKeyword(id, selected.ActionKeyword); _settings.SearchSources.Remove(selected); } } From 3e9a0e2c71c39aa85b79b2839fed4ec2d580e71e Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 23 Feb 2025 06:10:41 +0900 Subject: [PATCH 011/138] Added basic structure for fluent window --- Flow.Launcher.Core/Resource/Theme.cs | 151 ++++++++++++++++++++ Flow.Launcher.Infrastructure/Win32Helper.cs | 22 +++ Flow.Launcher/MainWindow.xaml | 10 +- Flow.Launcher/MainWindow.xaml.cs | 4 +- 4 files changed, 181 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 2c2feeae1..ed975aa9d 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -12,6 +12,9 @@ using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using System.Windows.Shell; +using static Flow.Launcher.Core.Resource.Theme.ParameterTypes; +using System.Runtime.InteropServices; +using System.Windows.Interop; namespace Flow.Launcher.Core.Resource { @@ -59,6 +62,153 @@ namespace Flow.Launcher.Core.Resource _oldTheme = Path.GetFileNameWithoutExtension(_oldResource.Source.AbsolutePath); } + #region Blur Handling + public class ParameterTypes + { + + [Flags] + public enum DWMWINDOWATTRIBUTE + { + DWMWA_USE_IMMERSIVE_DARK_MODE = 20, + DWMWA_SYSTEMBACKDROP_TYPE = 38, + DWMWA_TRANSITIONS_FORCEDISABLED = 3, + DWMWA_BORDER_COLOR + } + + [StructLayout(LayoutKind.Sequential)] + public struct MARGINS + { + public int cxLeftWidth; // width of left border that retains its size + public int cxRightWidth; // width of right border that retains its size + public int cyTopHeight; // height of top border that retains its size + public int cyBottomHeight; // height of bottom border that retains its size + }; + } + + public static class Methods + { + [DllImport("DwmApi.dll")] + static extern int DwmExtendFrameIntoClientArea( + IntPtr hwnd, + ref ParameterTypes.MARGINS pMarInset); + + [DllImport("dwmapi.dll")] + static extern int DwmSetWindowAttribute(IntPtr hwnd, ParameterTypes.DWMWINDOWATTRIBUTE dwAttribute, ref int pvAttribute, int cbAttribute); + + public static int ExtendFrame(IntPtr hwnd, ParameterTypes.MARGINS margins) + => DwmExtendFrameIntoClientArea(hwnd, ref margins); + + public static int SetWindowAttribute(IntPtr hwnd, ParameterTypes.DWMWINDOWATTRIBUTE attribute, int parameter) + => DwmSetWindowAttribute(hwnd, attribute, ref parameter, Marshal.SizeOf()); + } + + Window mainWindow = Application.Current.MainWindow; + + public void RefreshFrame() + { + IntPtr mainWindowPtr = new WindowInteropHelper(mainWindow).Handle; + HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr); + //mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 255, 181, 178); + + ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS(); + margins.cxLeftWidth = -1; + margins.cxRightWidth = -1; + margins.cyTopHeight = -1; + margins.cyBottomHeight = -1; + Methods.ExtendFrame(mainWindowSrc.Handle, margins); + + // Remove OS minimizing/maximizing animation + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3); + //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000); + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); + SetBlurForWindow(); + } + + + + /// + /// Sets the blur for a window via SetWindowCompositionAttribute + /// + public void SetBlurForWindow() + { + //SetWindowAccent(); + var dict = GetThemeResourceDictionary(Settings.Theme); + var windowBorderStyle = dict["WindowBorderStyle"] as Style; + if (BlurEnabled) + { + windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background")); + windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent))); + //mainWindow.WindowStyle = WindowStyle.SingleBorderWindow; + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); + BlurColor(BlurMode()); + } + else + { + mainWindow.WindowStyle = WindowStyle.None; + if (windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background") != null) + { + windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background")); + } + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 1); + } + UpdateResourceDictionary(dict); + } + + public void BlurColor(string Color) + { + if (Color == "Light") + { + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0); + } + else if (Color == "Dark") + { + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); + } + else /* Case of "Auto" Blur Type Theme */ + { + //if (_isDarkTheme()) + //{ + // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); + //} + //else + //{ + // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0); + //} + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); + } + + } + public bool IsBlurTheme() + { + if (Environment.OSVersion.Version >= new Version(6, 2)) + { + var resource = Application.Current.TryFindResource("ThemeBlurEnabled"); + + if (resource is bool) + return (bool)resource; + + return false; + } + + return false; + } + public string BlurMode() + { + if (Environment.OSVersion.Version >= new Version(6, 2)) + { + var resource = Application.Current.TryFindResource("BlurMode"); + + if (resource is string) + return (string)resource; + + return null; + } + + return null; + } + + #endregion + private void MakeSureThemeDirectoriesExist() { foreach (var dir in _themeDirectories.Where(dir => !Directory.Exists(dir))) @@ -103,6 +253,7 @@ namespace Flow.Launcher.Core.Resource AddDropShadowEffectToCurrentTheme(); Win32Helper.SetBlurForWindow(Application.Current.MainWindow, BlurEnabled); + //Win32Helper.SetMicaForWindow(Application.Current.MainWindow, BlurEnabled); } catch (DirectoryNotFoundException) { diff --git a/Flow.Launcher.Infrastructure/Win32Helper.cs b/Flow.Launcher.Infrastructure/Win32Helper.cs index 867fef4f5..856748537 100644 --- a/Flow.Launcher.Infrastructure/Win32Helper.cs +++ b/Flow.Launcher.Infrastructure/Win32Helper.cs @@ -7,6 +7,28 @@ namespace Flow.Launcher.Infrastructure { public static class Win32Helper { + private enum DwmSystemBackdropType + { + DWMSBT_AUTO = 0, + DWMSBT_NONE = 1, + DWMSBT_MICA = 2, + DWMSBT_ACRYLIC = 3, + DWMSBT_TABBED = 4 + } + + private const int DWMWA_SYSTEMBACKDROP_TYPE = 38; + + [DllImport("dwmapi.dll")] + private static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref DwmSystemBackdropType pvAttribute, int cbAttribute); + + public static void SetMicaForWindow(Window window, bool enableMica) + { + var windowHelper = new WindowInteropHelper(window); + windowHelper.EnsureHandle(); + + DwmSystemBackdropType backdropType = enableMica ? DwmSystemBackdropType.DWMSBT_MICA : DwmSystemBackdropType.DWMSBT_NONE; + DwmSetWindowAttribute(windowHelper.Handle, DWMWA_SYSTEMBACKDROP_TYPE, ref backdropType, sizeof(int)); + } #region Blur Handling /* diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 10fc3583b..22594217f 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -15,12 +15,11 @@ MinHeight="30" d:DataContext="{d:DesignInstance Type=vm:MainViewModel}" AllowDrop="True" - AllowsTransparency="True" - Background="Transparent" + AllowsTransparency="False" + Background="#DB213C95" Closing="OnClosing" Deactivated="OnDeactivated" Icon="Images/app.png" - SourceInitialized="OnSourceInitialized" Initialized="OnInitialized" Left="{Binding Settings.WindowLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Loaded="OnLoaded" @@ -31,10 +30,11 @@ ResizeMode="CanResize" ShowInTaskbar="False" SizeToContent="Height" + SourceInitialized="OnSourceInitialized" Topmost="True" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WindowStartupLocation="Manual" - WindowStyle="None" + WindowStyle="SingleBorderWindow" mc:Ignorable="d"> @@ -213,7 +213,7 @@ Modifiers="{Binding CycleHistoryDownHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" /> - + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 41dc68fd9..abb959ad8 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -60,7 +60,6 @@ namespace Flow.Launcher InitializePosition(); InitSoundEffects(); - DataObject.AddPastingHandler(QueryTextBox, OnPaste); this.Loaded += (_, _) => @@ -182,6 +181,9 @@ namespace Flow.Launcher private void OnLoaded(object sender, RoutedEventArgs _) { + // Remove OS minimizing/maximizing animation + ThemeManager.Instance.RefreshFrame(); + // MouseEventHandler PreviewMouseMove += MainPreviewMouseMove; CheckFirstLaunch(); From 270f5b3ca07f4fe51079295a48f4948f46674dd2 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 23 Feb 2025 09:48:33 +0900 Subject: [PATCH 012/138] Base Structure for fluent window --- Flow.Launcher.Core/Resource/Theme.cs | 52 ++++++++++++++----- Flow.Launcher/MainWindow.xaml | 4 +- Flow.Launcher/MainWindow.xaml.cs | 3 +- .../ViewModels/SettingsPaneThemeViewModel.cs | 1 + Flow.Launcher/Themes/BlurBlack.xaml | 2 +- Flow.Launcher/Themes/Win11Light.xaml | 4 +- 6 files changed, 48 insertions(+), 18 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index ed975aa9d..3ebcd65c7 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -15,6 +15,7 @@ using System.Windows.Shell; using static Flow.Launcher.Core.Resource.Theme.ParameterTypes; using System.Runtime.InteropServices; using System.Windows.Interop; +using System.Diagnostics; namespace Flow.Launcher.Core.Resource { @@ -119,8 +120,9 @@ namespace Flow.Launcher.Core.Resource // Remove OS minimizing/maximizing animation Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3); + //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000); - Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); + //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); SetBlurForWindow(); } @@ -131,24 +133,26 @@ namespace Flow.Launcher.Core.Resource /// public void SetBlurForWindow() { + //SetWindowAccent(); var dict = GetThemeResourceDictionary(Settings.Theme); var windowBorderStyle = dict["WindowBorderStyle"] as Style; + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); if (BlurEnabled) { + //mainWindow.WindowStyle = WindowStyle.SingleBorderWindow; + BlurColor(BlurMode()); windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background")); windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent))); - //mainWindow.WindowStyle = WindowStyle.SingleBorderWindow; Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); - BlurColor(BlurMode()); } else { - mainWindow.WindowStyle = WindowStyle.None; - if (windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background") != null) - { - windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background")); - } + //mainWindow.WindowStyle = WindowStyle.None; + //if (windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background") != null) + //{ + // windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background")); + //} Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 1); } UpdateResourceDictionary(dict); @@ -156,28 +160,34 @@ namespace Flow.Launcher.Core.Resource public void BlurColor(string Color) { + if (Color == "Light") { + //mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value); Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0); } else if (Color == "Dark") { + //mainWindow.Background = new SolidColorBrush(darkBGcolor.Value); Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); } else /* Case of "Auto" Blur Type Theme */ { //if (_isDarkTheme()) //{ + // mainWindow.Background = new SolidColorBrush(darkBGcolor.Value); // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); //} //else //{ + // mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value); // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0); //} - Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); - } + //mainWindow.Background = new SolidColorBrush(Colors.Red); + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); } } + public bool IsBlurTheme() { if (Environment.OSVersion.Version >= new Version(6, 2)) @@ -207,6 +217,24 @@ namespace Flow.Launcher.Core.Resource return null; } + //public SolidColorBrush BGColor(string colorBgKey) + //{ + // var defaultBG = Application.Current.TryFindResource("DefaultBG"); + // var darkBG = Application.Current.TryFindResource("DarkBG"); + + // if (colorBgKey == "") + // { + // var resource = Application.Current.TryFindResource("BlurMode"); + + // if (resource is string) + // return (SolidColorBrush)resource; + + // return new SolidColorBrush(Colors.DarkGray); + // } + + // return null; + //} + #endregion private void MakeSureThemeDirectoriesExist() @@ -252,8 +280,8 @@ namespace Flow.Launcher.Core.Resource if (Settings.UseDropShadowEffect && !BlurEnabled) AddDropShadowEffectToCurrentTheme(); - Win32Helper.SetBlurForWindow(Application.Current.MainWindow, BlurEnabled); - //Win32Helper.SetMicaForWindow(Application.Current.MainWindow, BlurEnabled); + //Win32Helper.SetBlurForWindow(Application.Current.MainWindow, BlurEnabled); + SetBlurForWindow(); } catch (DirectoryNotFoundException) { diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 22594217f..d99787a8d 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -16,7 +16,7 @@ d:DataContext="{d:DesignInstance Type=vm:MainViewModel}" AllowDrop="True" AllowsTransparency="False" - Background="#DB213C95" + Background="#E12E2E2E" Closing="OnClosing" Deactivated="OnDeactivated" Icon="Images/app.png" @@ -213,7 +213,7 @@ Modifiers="{Binding CycleHistoryDownHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" /> - + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index abb959ad8..8270150c2 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -61,7 +61,6 @@ namespace Flow.Launcher InitSoundEffects(); DataObject.AddPastingHandler(QueryTextBox, OnPaste); - this.Loaded += (_, _) => { var handle = new WindowInteropHelper(this).Handle; @@ -107,6 +106,7 @@ namespace Flow.Launcher return IntPtr.Zero; } + private void OnResizeEnd() { int shadowMargin = 0; @@ -181,7 +181,6 @@ namespace Flow.Launcher private void OnLoaded(object sender, RoutedEventArgs _) { - // Remove OS minimizing/maximizing animation ThemeManager.Instance.RefreshFrame(); // MouseEventHandler diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 8d8ccb780..ab2419d99 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -39,6 +39,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect) DropShadowEffect = false; + ThemeManager.Instance.RefreshFrame(); } } diff --git a/Flow.Launcher/Themes/BlurBlack.xaml b/Flow.Launcher/Themes/BlurBlack.xaml index 5d0fc2c3c..63fb83609 100644 --- a/Flow.Launcher/Themes/BlurBlack.xaml +++ b/Flow.Launcher/Themes/BlurBlack.xaml @@ -10,8 +10,8 @@ - True + Auto diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 4fe3c0495..52758171a 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -1,7 +1,7 @@ + True + Auto @@ -96,7 +88,7 @@ TargetType="{x:Type Rectangle}"> - + @@ -174,7 +166,7 @@ x:Key="ClockPanel" BasedOn="{StaticResource ClockPanel}" TargetType="{x:Type StackPanel}"> - + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index ba162fe9c..5ba82f12e 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -14,6 +14,7 @@ True Auto + ROUND #BFFAFAFA #DD202020 diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index ed290d0c8..29fe38a9c 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -11,8 +11,10 @@ True - light + Light + DoNotRound #BFFAFAFA + #BFFAFAFA diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index d6f9813d0..a8b04d640 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -1,7 +1,15 @@ - + + True + Light + RoundSmall + #DDFEC7D7 + #DDFEC7D7 0 0 0 0 From 2710de1fbcc20d82a3b58d471add4029e1947eac Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 6 Mar 2025 21:19:09 +0900 Subject: [PATCH 051/138] Fix Search Icon Opacity --- Flow.Launcher/MainWindow.xaml.cs | 24 ++++++++++++++++++++++-- Flow.Launcher/Themes/Base.xaml | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 19f928621..fc8a9f192 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -566,11 +566,14 @@ namespace Flow.Launcher FillBehavior = FillBehavior.HoldEnd }; - double TargetIconOpacity = SearchIcon.Opacity; + double TargetIconOpacity = GetOpacityFromStyle(SearchIcon, SearchIcon.Style, 1.0); // ์Šคํƒ€์ผ์—์„œ Opacity ๊ฐ€์ ธ์˜ค๊ธฐ + + System.Diagnostics.Debug.WriteLine("์Šคํƒ€์ผ์—์„œ ๊ฐ€์ ธ์˜จ ํˆฌ๋ช…๋„: " + TargetIconOpacity); + var IconOpacity = new DoubleAnimation { From = 0, - To = 1, + To = TargetIconOpacity, EasingFunction = easing, Duration = TimeSpan.FromMilliseconds(animationLength), FillBehavior = FillBehavior.HoldEnd @@ -626,6 +629,23 @@ namespace Flow.Launcher windowsb.Begin(FlowMainWindow); } + private double GetOpacityFromStyle(UIElement element, Style style, double defaultOpacity = 1.0) + { + if (style == null) + return defaultOpacity; + + foreach (Setter setter in style.Setters) + { + if (setter.Property == UIElement.OpacityProperty) + { + return setter.Value is double opacity ? opacity : defaultOpacity; + } + } + + return defaultOpacity; + } + + private bool _isClockPanelAnimating = false; // ์• ๋‹ˆ๋ฉ”์ด์…˜ ์‹คํ–‰ ์ค‘์ธ์ง€ ์—ฌ๋ถ€ private void UpdateClockPanelVisibility() diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 44850e94e..9df935b8d 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -165,6 +165,29 @@ BasedOn="{StaticResource BaseClockPanel}" TargetType="{x:Type StackPanel}"> + + From 46cdb2a2731f3489ccf5f6978c94d9757cbe25b5 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 8 Mar 2025 16:12:57 +0900 Subject: [PATCH 052/138] Fix Blink issue when hidestartup mode (hide on) --- Flow.Launcher.Core/Resource/Theme.cs | 8 ++++-- Flow.Launcher/MainWindow.xaml.cs | 13 ++++++++- Flow.Launcher/Themes/Pink.xaml | 6 ++-- Flow.Launcher/ViewModel/MainViewModel.cs | 35 ++++++++++++------------ 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index edf1da05e..c4e56e813 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -140,6 +140,7 @@ namespace Flow.Launcher.Core.Resource if (mainWindowSrc == null) return; + ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS(); margins.cxLeftWidth = -1; margins.cxRightWidth = -1; @@ -153,8 +154,7 @@ namespace Flow.Launcher.Core.Resource //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000); //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); - // The timing of adding the shadow effect should vary depending on whether the theme is transparent. - if (BlurEnabled) + // The timing of adding the shadow effect should vary depending on whether the theme is transparent. if (BlurEnabled) { AutoDropShadow(); } @@ -164,6 +164,7 @@ namespace Flow.Launcher.Core.Resource { AutoDropShadow(); } + } public void AutoDropShadow() @@ -248,6 +249,7 @@ namespace Flow.Launcher.Core.Resource var windowBorderStyle = dict["WindowBorderStyle"] as Style; if (windowBorderStyle == null) return; + //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); if (BlurEnabled) { @@ -255,9 +257,9 @@ namespace Flow.Launcher.Core.Resource //BlurColor(BlurMode()); Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~"); Debug.WriteLine(BlurMode()); + Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType().FirstOrDefault(x => x.Property.Name == "Background")); windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent))); - Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); //SetWindowCornerPreference("Round"); } else diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index fc8a9f192..4757b1fb4 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -815,12 +815,23 @@ namespace Flow.Launcher public void HideStartup() { UpdatePosition(); + if (_settings.HideOnStartup) { - _viewModel.Hide(); + // ๐Ÿ“Œ ์ตœ์ดˆ ์‹คํ–‰ ์‹œ ์ฐฝ์ด ๊นœ๋นก์ด๋Š” ๋ฌธ์ œ ๋ฐฉ์ง€ (์™„์ „ํžˆ ์ˆจ๊ธด ์ƒํƒœ๋กœ ์‹œ์ž‘) + System.Windows.Application.Current.MainWindow.Visibility = Visibility.Hidden; + + Dispatcher.BeginInvoke((Action)(() => + { + _viewModel.Hide(); + System.Windows.Application.Current.MainWindow.Visibility = Visibility.Collapsed; + }), DispatcherPriority.Background); } else { + // ๐Ÿ“Œ ์ตœ์ดˆ ์‹คํ–‰ ์‹œ ๊ทธ๋ฆผ์ž ํšจ๊ณผ๋ฅผ ๋ฏธ๋ฆฌ ์ ์šฉํ•˜์—ฌ Show() ํ•  ๋•Œ ๋ Œ๋”๋ง์ด ๋А๋ ค์ง€์ง€ ์•Š๋„๋ก ํ•จ + ThemeManager.Instance.SetBlurForWindow(); + //ThemeManager.Instance.AutoDropShadow(); _viewModel.Show(); } } diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index a8b04d640..3d8792a08 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -8,8 +8,8 @@ True Light RoundSmall - #DDFEC7D7 - #DDFEC7D7 + #4BFEC7D7 + #53FEC7D7 0 0 0 0 diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 3249fd221..6b225ae06 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1402,22 +1402,22 @@ namespace Flow.Launcher.ViewModel { IntPtr hWnd = new WindowInteropHelper(mainWindow).Handle; - // ๐Ÿ“Œ ์ฐฝ์„ ๋จผ์ € ๋ณด์ด๊ฒŒ ์„ค์ • - ShowWindow(hWnd, SW_SHOW); + // ๐Ÿ“Œ ์ฐฝ์„ ๋ณด์ด๋„๋ก ์„ค์ • (Cloak ์‚ฌ์šฉ ์•ˆ ํ•จ) + //ShowWindow(hWnd, SW_SHOW); + + // ๐Ÿ“Œ UI ์š”์†Œ ๋ณต์› mainWindow.ClockPanel.Visibility = Visibility.Visible; mainWindow.SearchIcon.Visibility = Visibility.Visible; - // ๐Ÿ“Œ DWM Cloak ํ•ด์ œ (์ฆ‰์‹œ ํ‘œ์‹œ) - int cloak = 0; - DwmSetWindowAttribute(hWnd, DWMWA_CLOAK, ref cloak, sizeof(int)); } // WPF ์†์„ฑ ์—…๋ฐ์ดํŠธ - //MainWindowOpacity = 1; + MainWindowVisibility = Visibility.Visible; MainWindowVisibilityStatus = true; VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true }); }); } + public async void Hide() { lastHistoryIndex = 1; @@ -1432,7 +1432,7 @@ namespace Flow.Launcher.ViewModel if (Application.Current.MainWindow is MainWindow mainWindow) { - // ๐Ÿ“Œ ์•„์ด์ฝ˜๊ณผ ์‹œ๊ณ„ Opacity๋ฅผ 0์œผ๋กœ ๊ฐ•์ œ ์„ค์ •ํ•˜๊ณ  Visibility.Hidden ์ ์šฉ (์ฟผ๋ฆฌ ์ƒํƒœ์™€ ๊ด€๊ณ„์—†์ด ์‹คํ–‰) + // ๐Ÿ“Œ ์•„์ด์ฝ˜๊ณผ ์‹œ๊ณ„ Opacity๋ฅผ 0์œผ๋กœ ์„ค์ •ํ•˜๊ณ  Visibility.Hidden ์ ์šฉ Application.Current.Dispatcher.Invoke(() => { mainWindow.ClockPanel.Opacity = 0; @@ -1445,7 +1445,7 @@ namespace Flow.Launcher.ViewModel mainWindow.SearchIcon.UpdateLayout(); }, DispatcherPriority.Render); - await Task.Delay(10); // UI ๋ฐ˜์˜ ๋Œ€๊ธฐ + //await Task.Delay(10); // UI ๋ฐ˜์˜ ๋Œ€๊ธฐ } // ๐Ÿ“Œ ํ…์ŠคํŠธ ์ดˆ๊ธฐํ™” ์ฆ‰์‹œ ์ ์šฉ + UI ๊ฐ•์ œ ์—…๋ฐ์ดํŠธ @@ -1478,23 +1478,22 @@ namespace Flow.Launcher.ViewModel break; } - if (Application.Current.MainWindow is MainWindow mainWindow2) - { - IntPtr hWnd = new WindowInteropHelper(mainWindow2).Handle; + //if (Application.Current.MainWindow is MainWindow mainWindow2) + //{ + // IntPtr hWnd = new WindowInteropHelper(mainWindow2).Handle; - // ๐Ÿ“Œ DWM Cloak ํ™œ์„ฑํ™” - int cloak = 1; - DwmSetWindowAttribute(hWnd, DWMWA_CLOAK, ref cloak, sizeof(int)); - - // ๐Ÿ“Œ ์ฐฝ์„ ์™„์ „ํžˆ ์ˆจ๊น€ (์ž”์ƒ ๋ฐฉ์ง€) - ShowWindow(hWnd, SW_HIDE); - } + // // ๐Ÿ“Œ Cloak์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์ผ๋ฐ˜์ ์ธ `ShowWindow(SW_HIDE)` ์‚ฌ์šฉ โ†’ Mica/Acrylic ์œ ์ง€๋จ + // ShowWindow(hWnd, SW_HIDE); + //} // WPF ์†์„ฑ ์—…๋ฐ์ดํŠธ MainWindowVisibilityStatus = false; + MainWindowVisibility = Visibility.Collapsed; VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = false }); } + + /// /// Checks if Flow Launcher should ignore any hotkeys /// From 01d081d74057bb22fc43036876cca4a8542fbe15 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 8 Mar 2025 18:30:17 +0900 Subject: [PATCH 053/138] Revert Startup Blinking --- Flow.Launcher.Core/Resource/Theme.cs | 3 ++- Flow.Launcher/MainWindow.xaml.cs | 15 ++++++++------- Flow.Launcher/Themes/Pink.xaml | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index c4e56e813..3fb4ea1d6 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -154,7 +154,8 @@ namespace Flow.Launcher.Core.Resource //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000); //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3); - // The timing of adding the shadow effect should vary depending on whether the theme is transparent. if (BlurEnabled) + // The timing of adding the shadow effect should vary depending on whether the theme is transparent. + if (BlurEnabled) { AutoDropShadow(); } diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 4757b1fb4..75c851ab3 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -819,18 +819,19 @@ namespace Flow.Launcher if (_settings.HideOnStartup) { // ๐Ÿ“Œ ์ตœ์ดˆ ์‹คํ–‰ ์‹œ ์ฐฝ์ด ๊นœ๋นก์ด๋Š” ๋ฌธ์ œ ๋ฐฉ์ง€ (์™„์ „ํžˆ ์ˆจ๊ธด ์ƒํƒœ๋กœ ์‹œ์ž‘) - System.Windows.Application.Current.MainWindow.Visibility = Visibility.Hidden; + //System.Windows.Application.Current.MainWindow.Visibility = Visibility.Hidden; - Dispatcher.BeginInvoke((Action)(() => - { - _viewModel.Hide(); - System.Windows.Application.Current.MainWindow.Visibility = Visibility.Collapsed; - }), DispatcherPriority.Background); + //Dispatcher.BeginInvoke((Action)(() => + //{ + // _viewModel.Hide(); + // System.Windows.Application.Current.MainWindow.Visibility = Visibility.Collapsed; + //}), DispatcherPriority.Background); + _viewModel.Hide(); } else { // ๐Ÿ“Œ ์ตœ์ดˆ ์‹คํ–‰ ์‹œ ๊ทธ๋ฆผ์ž ํšจ๊ณผ๋ฅผ ๋ฏธ๋ฆฌ ์ ์šฉํ•˜์—ฌ Show() ํ•  ๋•Œ ๋ Œ๋”๋ง์ด ๋А๋ ค์ง€์ง€ ์•Š๋„๋ก ํ•จ - ThemeManager.Instance.SetBlurForWindow(); + //ThemeManager.Instance.SetBlurForWindow(); //ThemeManager.Instance.AutoDropShadow(); _viewModel.Show(); } diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index 3d8792a08..90592bb99 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -8,7 +8,7 @@ True Light RoundSmall - #4BFEC7D7 + #B6C8C7FE #53FEC7D7 0 0 0 0 + From aeb3f22f7d56417d70f4936d9e207ff597009762 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 15 Mar 2025 15:02:07 +0900 Subject: [PATCH 081/138] - rollback pin theme to legacy --- Flow.Launcher/Themes/Pink.xaml | 75 +++++++++++++++------------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index 90592bb99..d7de4e246 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -1,55 +1,46 @@ - + - True - Light - RoundSmall - #B6C8C7FE - #53FEC7D7 - 0 0 0 0 + 0 0 0 4 - #0e172c + #cc1081 \ No newline at end of file From 53d647f2d06bd31233cac3308969c8cce414da67 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 16 Mar 2025 10:15:38 +0900 Subject: [PATCH 082/138] Adjust Themes for fluent --- Flow.Launcher/Resources/Dark.xaml | 16 ++++++++-------- Flow.Launcher/Resources/Light.xaml | 14 +++++++------- Flow.Launcher/Themes/BlurBlack Darker.xaml | 4 ++-- Flow.Launcher/Themes/BlurBlack.xaml | 4 ++-- Flow.Launcher/Themes/BlurWhite.xaml | 20 ++++++++++++++------ Flow.Launcher/Themes/Circle System.xaml | 9 +++++---- Flow.Launcher/Themes/Darker.xaml | 6 ++++-- Flow.Launcher/Themes/Win10System.xaml | 4 ++-- 8 files changed, 44 insertions(+), 33 deletions(-) diff --git a/Flow.Launcher/Resources/Dark.xaml b/Flow.Launcher/Resources/Dark.xaml index ed031c939..25cc8e878 100644 --- a/Flow.Launcher/Resources/Dark.xaml +++ b/Flow.Launcher/Resources/Dark.xaml @@ -7,17 +7,17 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib"> - + - - - - + + + + - - - + + + #198F8F8F diff --git a/Flow.Launcher/Resources/Light.xaml b/Flow.Launcher/Resources/Light.xaml index 8fe84588f..b9f65ce96 100644 --- a/Flow.Launcher/Resources/Light.xaml +++ b/Flow.Launcher/Resources/Light.xaml @@ -7,18 +7,18 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib"> - + - - + + - - - - #198F8F8F + + + + #0C000000 diff --git a/Flow.Launcher/Themes/BlurBlack Darker.xaml b/Flow.Launcher/Themes/BlurBlack Darker.xaml index 99cd9af0e..4cd8408fa 100644 --- a/Flow.Launcher/Themes/BlurBlack Darker.xaml +++ b/Flow.Launcher/Themes/BlurBlack Darker.xaml @@ -143,8 +143,8 @@ BasedOn="{StaticResource BaseSearchIconStyle}" TargetType="{x:Type Path}"> - - + + + @@ -79,7 +87,7 @@ x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}"> - + + Opacity="0.6" + Color="#33000000" /> @@ -79,7 +80,7 @@ x:Key="SeparatorStyle" BasedOn="{StaticResource BaseSeparatorStyle}" TargetType="{x:Type Rectangle}"> - + diff --git a/Flow.Launcher/Themes/Darker.xaml b/Flow.Launcher/Themes/Darker.xaml index d1abbe978..7d2614be8 100644 --- a/Flow.Launcher/Themes/Darker.xaml +++ b/Flow.Launcher/Themes/Darker.xaml @@ -29,7 +29,9 @@ @@ -123,7 +125,7 @@ Date: Sun, 16 Mar 2025 12:04:11 +0900 Subject: [PATCH 085/138] - Fix Logic for dwmBG - Remove Cornertypes in themes --- Flow.Launcher.Core/Resource/Theme.cs | 19 ++++++++++++++----- .../ViewModels/SettingsPaneThemeViewModel.cs | 4 +--- Flow.Launcher/Themes/BlurBlack Darker.xaml | 1 - Flow.Launcher/Themes/BlurBlack.xaml | 1 - Flow.Launcher/Themes/BlurWhite.xaml | 1 - Flow.Launcher/Themes/Circle System.xaml | 1 - 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 0dd1d5bbb..1ae755bd1 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -396,19 +396,26 @@ namespace Flow.Launcher.Core.Resource // Final decision on whether to use dark mode bool useDarkMode = false; - if (colorScheme == "Dark" || systemBG == "Dark") + // If systemBG is not "Auto", prioritize it over ColorScheme and set the mode based on systemBG value + if (systemBG == "Dark") { useDarkMode = true; // Dark } - else if (colorScheme == "Light" || systemBG == "Light") + else if (systemBG == "Light") { useDarkMode = false; // Light } - else if (colorScheme == "System" || systemBG == "Auto") + else if (systemBG == "Auto") { - useDarkMode = isSystemDark; // Auto + // If systemBG is "Auto", decide based on ColorScheme + if (colorScheme == "Dark") + useDarkMode = true; + else if (colorScheme == "Light") + useDarkMode = false; + else + useDarkMode = isSystemDark; // Auto (based on system setting) } - + // Apply DWM Dark Mode Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, useDarkMode ? 1 : 0); @@ -458,6 +465,8 @@ namespace Flow.Launcher.Core.Resource }, DispatcherPriority.Normal); } + + public bool IsBlurTheme() { if (Environment.OSVersion.Version >= new Version(6, 2)) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index dc9beec1c..87f5ed922 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -134,10 +134,8 @@ public partial class SettingsPaneThemeViewModel : BaseModel Constant.System => null, _ => ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme }; - - ThemeManager.Instance.RefreshFrame(); - Settings.ColorScheme = value; + ThemeManager.Instance.RefreshFrame(); } } diff --git a/Flow.Launcher/Themes/BlurBlack Darker.xaml b/Flow.Launcher/Themes/BlurBlack Darker.xaml index 4cd8408fa..9f7e6f5b0 100644 --- a/Flow.Launcher/Themes/BlurBlack Darker.xaml +++ b/Flow.Launcher/Themes/BlurBlack Darker.xaml @@ -13,7 +13,6 @@ True Dark - DoNotRound #C7000000 #C7000000 diff --git a/Flow.Launcher/Themes/BlurBlack.xaml b/Flow.Launcher/Themes/BlurBlack.xaml index 0e2f0e245..c45827074 100644 --- a/Flow.Launcher/Themes/BlurBlack.xaml +++ b/Flow.Launcher/Themes/BlurBlack.xaml @@ -12,7 +12,6 @@ True Dark - DoNotRound #B0000000 #B6000000 diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index e5f310c5a..8bf1f06e2 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -12,7 +12,6 @@ True Light - DoNotRound #BFFAFAFA #BFFAFAFA