Skip to content

Commit eeb38d8

Browse files
committed
Fix up Actionkeyword for folder result
1 parent d6ec4b5 commit eeb38d8

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Task InitAsync(PluginInitContext context)
4646

4747
contextMenu = new ContextMenu(Context, Settings, viewModel);
4848
searchManager = new SearchManager(Settings, Context);
49-
ResultManager.Init(Context);
49+
ResultManager.Init(Context, Settings);
5050

5151
return Task.CompletedTask;
5252
}

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search
1010
public static class ResultManager
1111
{
1212
private static PluginInitContext Context;
13+
private static Settings Settings { get; set; }
1314

14-
public static void Init(PluginInitContext context)
15+
public static void Init(PluginInitContext context, Settings settings)
1516
{
1617
Context = context;
18+
Settings = settings;
1719
}
1820

1921
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
@@ -41,23 +43,32 @@ internal static Result CreateFolderResult(string title, string subtitle, string
4143
}
4244

4345
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
44-
Context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
46+
Context.API.ChangeQuery(Settings.PathSearchActionKeyword == "*" ?
4547
changeTo :
46-
query.ActionKeyword + " " + changeTo);
48+
$"{Settings.PathSearchActionKeyword} {changeTo}");
4749
return false;
4850
},
4951
Score = score,
5052
TitleToolTip = Constants.ToolTipOpenDirectory,
5153
SubTitleToolTip = Constants.ToolTipOpenDirectory,
52-
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed }
54+
ContextData = new SearchResult
55+
{
56+
Type = ResultType.Folder,
57+
FullPath = path,
58+
ShowIndexState = showIndexState,
59+
WindowsIndexed = windowsIndexed
60+
}
5361
};
5462
}
5563

5664
internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIndexed = false)
5765
{
5866
var retrievedDirectoryPath = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path);
5967

60-
var folderName = retrievedDirectoryPath.TrimEnd(Constants.DirectorySeperator).Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
68+
var folderName = retrievedDirectoryPath.TrimEnd(Constants.DirectorySeperator).Split(new[]
69+
{
70+
Path.DirectorySeparatorChar
71+
}, StringSplitOptions.None).Last();
6172

6273
if (retrievedDirectoryPath.EndsWith(":\\"))
6374
{
@@ -81,7 +92,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
8192
{
8293
Title = title,
8394
SubTitle = $"Use > to search within {subtitleFolderName}, " +
84-
$"* to search for file extensions or >* to combine both searches.",
95+
$"* to search for file extensions or >* to combine both searches.",
8596
IcoPath = retrievedDirectoryPath,
8697
Score = 500,
8798
Action = c =>
@@ -91,7 +102,13 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
91102
},
92103
TitleToolTip = retrievedDirectoryPath,
93104
SubTitleToolTip = retrievedDirectoryPath,
94-
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = retrievedDirectoryPath, ShowIndexState = true, WindowsIndexed = windowsIndexed }
105+
ContextData = new SearchResult
106+
{
107+
Type = ResultType.Folder,
108+
FullPath = retrievedDirectoryPath,
109+
ShowIndexState = true,
110+
WindowsIndexed = windowsIndexed
111+
}
95112
};
96113
}
97114

@@ -126,7 +143,13 @@ internal static Result CreateFileResult(string filePath, Query query, int score
126143
},
127144
TitleToolTip = Constants.ToolTipOpenContainingFolder,
128145
SubTitleToolTip = Constants.ToolTipOpenContainingFolder,
129-
ContextData = new SearchResult { Type = ResultType.File, FullPath = filePath, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed }
146+
ContextData = new SearchResult
147+
{
148+
Type = ResultType.File,
149+
FullPath = filePath,
150+
ShowIndexState = showIndexState,
151+
WindowsIndexed = windowsIndexed
152+
}
130153
};
131154
return result;
132155
}
@@ -148,4 +171,4 @@ public enum ResultType
148171
Folder,
149172
File
150173
}
151-
}
174+
}

0 commit comments

Comments
 (0)