Skip to content

Commit 3e1f962

Browse files
authored
Merge pull request #3833 from WayneFerdon/dev
Add Empty Query Returning & Change ThemeSelector Keyword with ActionKeyword for Sys Plugin
2 parents fa6301b + 539a852 commit 3e1f962

File tree

1 file changed

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

1 file changed

+17
-3
lines changed

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

Lines changed: 17 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.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,15 @@ 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+
if (string.IsNullOrEmpty(query.ActionKeyword))
501+
{
502+
_context.API.ChangeQuery($"{ThemeSelector.Keyword}{Plugin.Query.ActionKeywordSeparator}");
503+
}
504+
else
505+
{
506+
_context.API.ChangeQuery($"{query.ActionKeyword}{Plugin.Query.ActionKeywordSeparator}{ThemeSelector.Keyword}{Plugin.Query.ActionKeywordSeparator}");
507+
508+
}
495509
return false;
496510
}
497511
}

0 commit comments

Comments
 (0)