Skip to content

Commit a34b8f2

Browse files
committed
[Plugin.Sys Enhancement] Support returning all usable commands while query is empty; ChangeQuery by ThemeSelector Action with ActionKeyword at the front as well
1 parent 50e570e commit a34b8f2

File tree

1 file changed

+9
-3
lines changed
  • Plugins/Flow.Launcher.Plugin.Sys

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ public List<Result> Query(Query query)
7070
return _themeSelector.Query(query);
7171
}
7272

73-
var commands = Commands();
73+
var commands = Commands(query);
7474
var results = new List<Result>();
75+
var isEmptyQuery = string.IsNullOrEmpty(query.Search) || string.IsNullOrWhiteSpace(query.Search);
7576
foreach (var c in commands)
7677
{
7778
var command = _settings.Commands.First(x => x.Key == c.Title);
7879
c.Title = command.Name;
7980
c.SubTitle = command.Description;
81+
if (isEmptyQuery)
82+
{
83+
results.Add(c);
84+
continue;
85+
}
8086

8187
// Match from localized title & localized subtitle & keyword
8288
var titleMatch = _context.API.FuzzySearch(query.Search, c.Title);
@@ -188,7 +194,7 @@ private static unsafe bool EnableShutdownPrivilege()
188194
}
189195
}
190196

191-
private List<Result> Commands()
197+
private List<Result> Commands(Query query)
192198
{
193199
var results = new List<Result>();
194200
var recycleBinFolder = "shell:RecycleBinFolder";
@@ -491,7 +497,7 @@ private List<Result> Commands()
491497
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\ue790"),
492498
Action = c =>
493499
{
494-
_context.API.ChangeQuery($"{ThemeSelector.Keyword} ");
500+
_context.API.ChangeQuery($"{query.ActionKeyword}{ (string.IsNullOrEmpty(query.ActionKeyword) ? string.Empty : Plugin.Query.ActionKeywordSeparator)}{ThemeSelector.Keyword}{Plugin.Query.ActionKeywordSeparator}");
495501
return false;
496502
}
497503
}

0 commit comments

Comments
 (0)