Add file path in preview

This commit is contained in:
Vic 2023-04-21 23:52:00 +08:00
parent 0c4f50a89f
commit 1cedb6e619
2 changed files with 19 additions and 10 deletions

View file

@ -77,6 +77,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search
AutoCompleteText = GetAutoCompleteText(title, query, path, ResultType.Folder),
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
CopyText = path,
Preview = new Result.PreviewInfo
{
FilePath = path,
},
Action = c =>
{
// open folder
@ -162,6 +166,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Score = 500,
ProgressBar = progressValue,
ProgressBarColor = progressBarColor,
Preview = new Result.PreviewInfo
{
FilePath = path,
},
Action = _ =>
{
OpenFolder(path);
@ -234,15 +242,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
internal static Result CreateFileResult(string filePath, Query query, int score = 0, bool windowsIndexed = false)
{
Result.PreviewInfo preview = IsMedia(Path.GetExtension(filePath))
? new Result.PreviewInfo
{
IsMedia = true,
PreviewImagePath = filePath,
FilePath = filePath,
}
: Result.PreviewInfo.Default;
bool isMedia = IsMedia(Path.GetExtension(filePath));
var title = Path.GetFileName(filePath);
var result = new Result
@ -250,7 +250,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Title = title,
SubTitle = Path.GetDirectoryName(filePath),
IcoPath = filePath,
Preview = preview,
Preview = new Result.PreviewInfo
{
IsMedia = isMedia,
PreviewImagePath = isMedia ? filePath : null,
FilePath = filePath,
},
AutoCompleteText = GetAutoCompleteText(title, query, filePath, ResultType.File),
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
Score = score,

View file

@ -168,6 +168,10 @@ namespace Flow.Launcher.Plugin.Program.Programs
Score = matchResult.Score,
TitleHighlightData = matchResult.MatchData,
ContextData = this,
Preview = new Result.PreviewInfo
{
FilePath = ExecutablePath,
},
Action = c =>
{
// Ctrl + Enter to open containing folder