From 53b0b88aebbef03b648c8e59784901bda7de1ea1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 14:59:30 +0000 Subject: [PATCH 01/17] Initial plan From 953ecb2881857474395a95d20a9d23a2a0fa49d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 15:07:36 +0000 Subject: [PATCH 02/17] Boost score for Windows home folders in Explorer search results - Add HomeFolderPaths lazy set with known Windows home folder paths - Add IsHomeFolderPath helper method with null guard - Boost score by 50 in CreateFolderResult for home folders - Add Properties/AssemblyInfo.cs with InternalsVisibleTo for test project - Add unit tests for IsHomeFolderPath Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com> --- Flow.Launcher.Test/Plugins/ExplorerTest.cs | 51 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 3 ++ .../Search/ResultManager.cs | 39 ++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs index 9ec95215556..08b8ec33639 100644 --- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs +++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs @@ -438,5 +438,56 @@ public void GivenPath_WhenHavingEnvironmentVariableOrNot_ThenShouldBeExpected(st // Then ClassicAssert.AreEqual(result, expectedResult); } + + [Test] + public void GivenHomeFolderPaths_WhenCheckedWithIsHomeFolderPath_ThenShouldReturnTrue() + { + // Given + var homeFolders = new[] + { + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), + Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), + Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), + Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), + Environment.GetFolderPath(Environment.SpecialFolder.Desktop), + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"), + }; + + // When, Then + foreach (var folder in homeFolders) + { + if (string.IsNullOrEmpty(folder)) + continue; + + ClassicAssert.IsTrue(ResultManager.IsHomeFolderPath(folder), + $"Expected '{folder}' to be recognized as a home folder"); + ClassicAssert.IsTrue(ResultManager.IsHomeFolderPath(folder + Path.DirectorySeparatorChar), + $"Expected '{folder}\\' (with trailing separator) to be recognized as a home folder"); + } + } + + [Test] + public void GivenNonHomeFolderPaths_WhenCheckedWithIsHomeFolderPath_ThenShouldReturnFalse() + { + // Given + var nonHomeFolders = new[] + { + @"C:\SomeRandomFolder", + @"C:\Windows\System32", + @"C:\Program Files", + // Subfolders of home directories should not be recognized as home folders + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "SubFolder"), + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "SubFolder"), + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads", "SubFolder"), + }; + + // When, Then + foreach (var folder in nonHomeFolders) + { + ClassicAssert.IsFalse(ResultManager.IsHomeFolderPath(folder), + $"Expected '{folder}' to NOT be recognized as a home folder"); + } + } } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..a15280e58ef --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Flow.Launcher.Test")] diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 18eb168b9bd..43a08fb5b41 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -21,6 +22,41 @@ public static class ResultManager private static PluginInitContext Context; private static Settings Settings { get; set; } + private const int HomeFolderScoreBoost = 50; + + private static readonly Lazy> HomeFolderPaths = new(() => + { + var paths = new HashSet(StringComparer.OrdinalIgnoreCase); + + var specialFolders = new[] + { + Environment.SpecialFolder.MyDocuments, + Environment.SpecialFolder.MyPictures, + Environment.SpecialFolder.MyMusic, + Environment.SpecialFolder.MyVideos, + Environment.SpecialFolder.Desktop, + Environment.SpecialFolder.UserProfile, + }; + + foreach (var folder in specialFolders) + { + var path = Environment.GetFolderPath(folder); + if (!string.IsNullOrEmpty(path)) + paths.Add(path); + } + + // Downloads has no dedicated SpecialFolder enum value + var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + if (!string.IsNullOrEmpty(userProfile)) + paths.Add(Path.Combine(userProfile, "Downloads")); + + return paths; + }); + + internal static bool IsHomeFolderPath(string path) => + !string.IsNullOrEmpty(path) && + HomeFolderPaths.Value.Contains(path.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)); + public static void Init(PluginInitContext context, Settings settings) { Context = context; @@ -94,6 +130,9 @@ internal static void ShowNativeContextMenu(string path, ResultType type) internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { + if (IsHomeFolderPath(path)) + score += HomeFolderScoreBoost; + return new Result { Title = title, From 6122a92494918d51c5b2233bf150964fec52d483 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 14 Mar 2026 23:14:59 +0800 Subject: [PATCH 03/17] Remove InternalsVisibleTo from AssemblyInfo.cs Removed System.Runtime.CompilerServices import and InternalsVisibleTo attribute, restricting internal member access from Flow.Launcher.Test project. --- .../Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs deleted file mode 100644 index a15280e58ef..00000000000 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Flow.Launcher.Test")] From 97ef374ecfcf181b15c28ccb84e976d67e4363c0 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 14 Mar 2026 23:21:24 +0800 Subject: [PATCH 04/17] Make IsHomeFolderPath public in ResultManager Changed IsHomeFolderPath method visibility from internal to public, enabling access from outside the assembly. --- Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 43a08fb5b41..d51e714d43b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -53,7 +53,7 @@ public static class ResultManager return paths; }); - internal static bool IsHomeFolderPath(string path) => + public static bool IsHomeFolderPath(string path) => !string.IsNullOrEmpty(path) && HomeFolderPaths.Value.Contains(path.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)); From d0b60bde5f2d9400fe51274c929ca35faf340375 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 14 Mar 2026 23:23:26 +0800 Subject: [PATCH 05/17] Boost home folder score only if score > 0 Adjusted folder result creation logic to boost score for home folders only when the initial score is greater than zero, preventing unnecessary score increases for zero-score results. --- Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index d51e714d43b..b47353b50bf 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -130,7 +130,7 @@ internal static void ShowNativeContextMenu(string path, ResultType type) internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { - if (IsHomeFolderPath(path)) + if (IsHomeFolderPath(path) && score > 0) score += HomeFolderScoreBoost; return new Result From 3b22ef863c37ee5fe39936468c4db8d5c5a409c4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 14 Mar 2026 23:30:59 +0800 Subject: [PATCH 06/17] Revert "Boost home folder score only if score > 0" This reverts commit d0b60bde5f2d9400fe51274c929ca35faf340375. --- Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index b47353b50bf..d51e714d43b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -130,7 +130,7 @@ internal static void ShowNativeContextMenu(string path, ResultType type) internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { - if (IsHomeFolderPath(path) && score > 0) + if (IsHomeFolderPath(path)) score += HomeFolderScoreBoost; return new Result From 3884ffa1bc8c71837da8a940d0877fe94a85a68f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 04:38:15 +0000 Subject: [PATCH 07/17] Initial plan From 8b9d52cf3e71500147d528a47a42a99ea1acb3b7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 04:47:54 +0000 Subject: [PATCH 08/17] Add optional setting to enable/disable home folder score boost Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com> --- .../Languages/en.xaml | 1 + .../Search/ResultManager.cs | 2 +- .../Flow.Launcher.Plugin.Explorer/Settings.cs | 2 + .../Views/ExplorerSettings.xaml | 44 ++++++++++++------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 45c0d72acd9..206d2ecb4da 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -51,6 +51,7 @@ Use search result's location as the working directory of the executable Display more information like size and age in tooltips Hit Enter to open folder in Default File Manager + Boost score for home folders (Documents, Desktop, Downloads, etc.) Use Index Search For Path Search Indexing Options Search: diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index d51e714d43b..70534458aec 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -130,7 +130,7 @@ internal static void ShowNativeContextMenu(string path, ResultType type) internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { - if (IsHomeFolderPath(path)) + if (Settings.BoostHomeFolderScore && IsHomeFolderPath(path)) score += HomeFolderScoreBoost; return new Result diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 08e0015d4e1..b0fbad84fbe 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -39,6 +39,8 @@ public class Settings public bool DisplayMoreInformationInToolTip { get; set; } = false; + public bool BoostHomeFolderScore { get; set; } = true; + public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public bool SearchActionKeywordEnabled { get; set; } = true; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 79000e70055..d6066df953f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -202,6 +202,7 @@ + @@ -234,16 +235,25 @@ Content="{DynamicResource plugin_explorer_display_more_info_in_tooltip}" IsChecked="{Binding Settings.DisplayMoreInformationInToolTip}" /> - + + @@ -262,7 +272,7 @@ @@ -289,7 +299,7 @@ @@ -316,14 +326,14 @@