mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Prepend folder action keyword
This commit is contained in:
parent
74f97f1b95
commit
b201d789d2
1 changed files with 10 additions and 8 deletions
|
|
@ -13,11 +13,19 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
{
|
{
|
||||||
private static PluginInitContext Context;
|
private static PluginInitContext Context;
|
||||||
private static Settings Settings { get; set; }
|
private static Settings Settings { get; set; }
|
||||||
|
public static object Keyword { get; private set; }
|
||||||
|
|
||||||
public static void Init(PluginInitContext context, Settings settings)
|
public static void Init(PluginInitContext context, Settings settings)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
|
Keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
|
||||||
|
Keyword = Keyword.ToString() == Query.GlobalPluginWildcardSign ? string.Empty : Keyword + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ChangeToPath(string path)
|
||||||
|
{
|
||||||
|
return path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
|
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false)
|
||||||
|
|
@ -27,7 +35,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
Title = title,
|
Title = title,
|
||||||
IcoPath = path,
|
IcoPath = path,
|
||||||
SubTitle = subtitle,
|
SubTitle = subtitle,
|
||||||
AutoCompleteText = $"{path}\\",
|
AutoCompleteText = $"{Keyword}{ChangeToPath(path)}",
|
||||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
|
|
@ -44,13 +52,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// one of it is enabled
|
Context.API.ChangeQuery($"{Keyword}{ChangeToPath(path)}");
|
||||||
var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
|
|
||||||
|
|
||||||
keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " ";
|
|
||||||
|
|
||||||
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
|
|
||||||
Context.API.ChangeQuery($"{keyword}{changeTo}");
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
Score = score,
|
Score = score,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue