Skip to content

Commit e49e0ae

Browse files
committed
output quick folder access list when no query and only hotkey is pressed
1 parent cd27cc1 commit e49e0ae

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public List<Result> LoadContextMenus(Result selectedResult)
3737

3838
public List<Result> Query(Query query)
3939
{
40-
var results = new List<Result>();
41-
42-
if (string.IsNullOrEmpty(query.Search))
43-
return results;
44-
4540
return new SearchManager(Settings, Context).Search(query);
4641
}
4742

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
2-
using Flow.Launcher.Plugin.SharedCommands;
3-
using System;
1+
using System;
42
using System.Collections.Generic;
53
using System.Linq;
6-
using System.Text;
7-
using System.Windows;
84

95
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
106
{
117
public class QuickFolderAccess
128
{
139
internal List<Result> FolderList(Query query, List<FolderLink> folderLinks, PluginInitContext context)
1410
{
11+
if (string.IsNullOrEmpty(query.Search))
12+
return folderLinks
13+
.Select(item =>
14+
new ResultManager(context)
15+
.CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query))
16+
.ToList();
17+
1518
string search = query.Search.ToLower();
16-
var userFolderLinks = folderLinks.Where(
17-
x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
18-
var results = userFolderLinks.Select(item =>
19-
new ResultManager(context).CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query)).ToList();
20-
return results;
19+
20+
var queriedFolderLinks = folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
21+
22+
return queriedFolderLinks.Select(item =>
23+
new ResultManager(context)
24+
.CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query))
25+
.ToList();
2126
}
2227
}
2328
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,29 @@ public SearchManager(Settings settings, PluginInitContext context)
3030

3131
internal List<Result> Search(Query query)
3232
{
33+
var results = new List<Result>();
34+
3335
var querySearch = query.Search;
3436

3537
var quickFolderLinks = quickFolderAccess.FolderList(query, settings.QuickFolderAccessLinks, context);
3638

3739
if (quickFolderLinks.Count > 0)
3840
return quickFolderLinks;
3941

42+
if (string.IsNullOrEmpty(query.Search))
43+
return results;
44+
4045
if (!FilesFolders.IsLocationPathString(querySearch))
4146
return WindowsIndexFilesAndFoldersSearch(query, querySearch);
4247

4348
var locationPath = query.Search;
4449

4550
if (EnvironmentVariables.IsEnvironmentVariableSearch(locationPath))
46-
{
4751
return EnvironmentVariables.GetEnvironmentStringPathSuggestions(locationPath, query, context);
48-
}
4952

5053
// Query is a location path with a full environment variable, eg. %appdata%\somefolder\
5154
if (locationPath.Substring(1).Contains("%"))
52-
{
5355
locationPath = EnvironmentVariables.TranslateEnvironmentVariablePath(locationPath);
54-
}
55-
56-
var results = new List<Result>();
5756

5857
if (!FilesFolders.LocationExists(FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
5958
return results;

0 commit comments

Comments
 (0)