diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
index fb773f562..80c3bbec5 100644
--- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
+++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
@@ -53,7 +53,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs
index e0cc9b4c2..36f0294a9 100644
--- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs
+++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs
@@ -269,5 +269,129 @@ namespace Flow.Launcher.Test.Plugins
// Then
Assert.AreEqual(expectedString, resultString);
}
+
+ [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "irrelevant", false, true, "c:\\somefolder\\someotherfolder\\")]
+ [TestCase("c:\\somefolder\\someotherfolder\\", ResultType.Folder, "irrelevant", true, true, "c:\\somefolder\\someotherfolder\\")]
+ [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "irrelevant", true, false, "p c:\\somefolder\\someotherfolder\\")]
+ [TestCase("c:\\somefolder\\someotherfolder\\", ResultType.Folder, "irrelevant", false, false, "c:\\somefolder\\someotherfolder\\")]
+ [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "p", true, false, "p c:\\somefolder\\someotherfolder\\")]
+ [TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "", true, true, "c:\\somefolder\\someotherfolder\\")]
+ public void GivenFolderResult_WhenGetPath_ThenPathShouldBeExpectedString(
+ string path,
+ ResultType type,
+ string actionKeyword,
+ bool pathSearchKeywordEnabled,
+ bool searchActionKeywordEnabled,
+ string expectedResult)
+ {
+ // Given
+ var settings = new Settings()
+ {
+ PathSearchKeywordEnabled = pathSearchKeywordEnabled,
+ PathSearchActionKeyword = "p",
+ SearchActionKeywordEnabled = searchActionKeywordEnabled,
+ SearchActionKeyword = Query.GlobalPluginWildcardSign
+ };
+ ResultManager.Init(new PluginInitContext(), settings);
+
+ // When
+ var result = ResultManager.GetPathWithActionKeyword(path, type, actionKeyword);
+
+ // Then
+ Assert.AreEqual(result, expectedResult);
+ }
+
+ [TestCase("c:\\somefolder\\somefile", ResultType.File, "irrelevant", false, true, "e c:\\somefolder\\somefile")]
+ [TestCase("c:\\somefolder\\somefile", ResultType.File, "p", true, false, "p c:\\somefolder\\somefile")]
+ [TestCase("c:\\somefolder\\somefile", ResultType.File, "e", true, true, "e c:\\somefolder\\somefile")]
+ [TestCase("c:\\somefolder\\somefile", ResultType.File, "irrelevant", false, false, "e c:\\somefolder\\somefile")]
+ public void GivenFileResult_WhenGetPath_ThenPathShouldBeExpectedString(
+ string path,
+ ResultType type,
+ string actionKeyword,
+ bool pathSearchKeywordEnabled,
+ bool searchActionKeywordEnabled,
+ string expectedResult)
+ {
+ // Given
+ var settings = new Settings()
+ {
+ PathSearchKeywordEnabled = pathSearchKeywordEnabled,
+ PathSearchActionKeyword = "p",
+ SearchActionKeywordEnabled = searchActionKeywordEnabled,
+ SearchActionKeyword = "e"
+ };
+ ResultManager.Init(new PluginInitContext(), settings);
+
+ // When
+ var result = ResultManager.GetPathWithActionKeyword(path, type, actionKeyword);
+
+ // Then
+ Assert.AreEqual(result, expectedResult);
+ }
+
+ [TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "q", false, false, "q somefolder")]
+ [TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "i", true, false, "p c:\\somefolder\\")]
+ [TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "irrelevant", true, true, "c:\\somefolder\\")]
+ public void GivenQueryWithFolderTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString(
+ string title,
+ string path,
+ ResultType resultType,
+ string actionKeyword,
+ bool pathSearchKeywordEnabled,
+ bool searchActionKeywordEnabled,
+ string expectedResult)
+ {
+ // Given
+ var query = new Query() { ActionKeyword = actionKeyword };
+ var settings = new Settings()
+ {
+ PathSearchKeywordEnabled = pathSearchKeywordEnabled,
+ PathSearchActionKeyword = "p",
+ SearchActionKeywordEnabled = searchActionKeywordEnabled,
+ SearchActionKeyword = Query.GlobalPluginWildcardSign,
+ QuickAccessActionKeyword = "q",
+ IndexSearchActionKeyword = "i"
+ };
+ ResultManager.Init(new PluginInitContext(), settings);
+
+ // When
+ var result = ResultManager.GetAutoCompleteText(title, query, path, resultType);
+
+ // Then
+ Assert.AreEqual(result, expectedResult);
+ }
+
+ [TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "q", false, false, "q somefile")]
+ [TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "i", true, false, "p c:\\somefolder\\somefile")]
+ [TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "irrelevant", true, true, "c:\\somefolder\\somefile")]
+ public void GivenQueryWithFileTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString(
+ string title,
+ string path,
+ ResultType resultType,
+ string actionKeyword,
+ bool pathSearchKeywordEnabled,
+ bool searchActionKeywordEnabled,
+ string expectedResult)
+ {
+ // Given
+ var query = new Query() { ActionKeyword = actionKeyword };
+ var settings = new Settings()
+ {
+ QuickAccessActionKeyword = "q",
+ IndexSearchActionKeyword = "i",
+ PathSearchActionKeyword = "p",
+ PathSearchKeywordEnabled = pathSearchKeywordEnabled,
+ SearchActionKeywordEnabled = searchActionKeywordEnabled,
+ SearchActionKeyword = Query.GlobalPluginWildcardSign
+ };
+ ResultManager.Init(new PluginInitContext(), settings);
+
+ // When
+ var result = ResultManager.GetAutoCompleteText(title, query, path, resultType);
+
+ // Then
+ Assert.AreEqual(result, expectedResult);
+ }
}
}
diff --git a/Flow.Launcher/Resources/CustomControlTemplate.xaml b/Flow.Launcher/Resources/CustomControlTemplate.xaml
index 1031ab32d..505b7c2a3 100644
--- a/Flow.Launcher/Resources/CustomControlTemplate.xaml
+++ b/Flow.Launcher/Resources/CustomControlTemplate.xaml
@@ -2999,8 +2999,6 @@
-
-
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index c474e2a15..e9422cc3a 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -780,8 +780,16 @@ namespace Flow.Launcher.ViewModel
{
foreach (var shortcut in builtInShortcuts)
{
- queryBuilder.Replace(shortcut.Key, shortcut.Expand());
- queryBuilderTmp.Replace(shortcut.Key, shortcut.Expand());
+ try
+ {
+ var expansion = shortcut.Expand();
+ queryBuilder.Replace(shortcut.Key, expansion);
+ queryBuilderTmp.Replace(shortcut.Key, expansion);
+ }
+ catch (Exception e)
+ {
+ Log.Exception($"{nameof(MainViewModel)}.{nameof(ConstructQuery)}|Error when expanding shortcut {shortcut.Key}", e);
+ }
}
});
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index c0025a20c..b43773ac6 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -500,7 +500,9 @@ namespace Flow.Launcher.ViewModel
"tt h:mm",
"tt hh:mm",
"h:mm tt",
- "hh:mm tt"
+ "hh:mm tt",
+ "hh:mm:ss tt",
+ "HH:mm:ss"
};
public List DateFormatList { get; } = new()
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index 214a779e4..2676b27b2 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -21,11 +21,22 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Settings = settings;
}
- private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
+ public static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
{
- // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
- var keyword = actionKeyword != string.Empty ? actionKeyword + " " : string.Empty;
+ // actionKeyword will be empty string if using global, query.ActionKeyword is ""
+ var usePathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled;
+
+ var pathSearchActionKeyword = Settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign
+ ? string.Empty
+ : $"{Settings.PathSearchActionKeyword} ";
+
+ var searchActionKeyword = Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
+ ? string.Empty
+ : $"{Settings.SearchActionKeyword} ";
+
+ var keyword = usePathSearchActionKeyword ? pathSearchActionKeyword : searchActionKeyword;
+
var formatted_path = path;
if (type == ResultType.Folder)
@@ -35,6 +46,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search
return $"{keyword}{formatted_path}";
}
+ public static string GetAutoCompleteText(string title, Query query, string path, ResultType resultType)
+ {
+ return !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
+ ? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
+ : GetPathWithActionKeyword(path, resultType, query.ActionKeyword);
+ }
+
public static Result CreateResult(Query query, SearchResult result)
{
return result.Type switch
@@ -54,7 +72,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Title = title,
IcoPath = path,
SubTitle = Path.GetDirectoryName(path),
- AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword),
+ AutoCompleteText = GetAutoCompleteText(title, query, path, ResultType.Folder),
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
CopyText = path,
Action = c =>
@@ -202,14 +220,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search
PreviewImagePath = filePath,
} : Result.PreviewInfo.Default;
+ var title = Path.GetFileName(filePath);
+
var result = new Result
{
- Title = Path.GetFileName(filePath),
+ Title = title,
SubTitle = Path.GetDirectoryName(filePath),
IcoPath = filePath,
Preview = preview,
- AutoCompleteText = GetPathWithActionKeyword(filePath, ResultType.File, query.ActionKeyword),
- TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
+ AutoCompleteText = GetAutoCompleteText(title, query, filePath, ResultType.File),
+ TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
Score = score,
CopyText = filePath,
Action = c =>
diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json b/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json
index 1d2af9e51..9a0783faf 100644
--- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json
+++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/WindowsSettings.json
@@ -3419,7 +3419,7 @@
"Name": "CreateAndFormatHardDiskPartitions",
"Area": "Unknown",
"Type": "TaskLink",
- "Command": "%windir%\\system32\\mmc.exe %windir%\\system32\\diskmgmt.msc",
+ "Command": "%windir%\\system32\\diskmgmt.msc",
"Keywords": [
[
"clean-up",