mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
merge PR #94: Explorer plugin enhancements
This commit is contained in:
commit
97ca6269b2
10 changed files with 53 additions and 11 deletions
|
|
@ -130,5 +130,15 @@ namespace Flow.Launcher.Plugin
|
|||
/// Plugin ID that generated this result
|
||||
/// </summary>
|
||||
public string PluginID { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show message as ToolTip on result Title hover over
|
||||
/// </summary>
|
||||
public string TitleToolTip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show message as ToolTip on result SubTitle hover over
|
||||
/// </summary>
|
||||
public string SubTitleToolTip { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,9 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
public static class FilesFolders
|
||||
{
|
||||
private const string FileExplorerProgramName = "explorer";
|
||||
|
||||
private const string FileExplorerProgramEXE = "explorer.exe";
|
||||
|
||||
public static void Copy(this string sourcePath, string targetPath)
|
||||
{
|
||||
// Get the subdirectories for the specified directory.
|
||||
|
|
@ -128,6 +131,11 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
}
|
||||
}
|
||||
|
||||
public static void OpenContainingFolder(string path)
|
||||
{
|
||||
Process.Start(FileExplorerProgramEXE, $" /select,\"{path}\"");
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// This checks whether a given string is a directory path or network location string.
|
||||
/// It does not check if location actually exists.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
</TextBlock>
|
||||
</StackPanel>
|
||||
<TextBlock Style="{DynamicResource ItemTitleStyle}" DockPanel.Dock="Left"
|
||||
VerticalAlignment="Center" ToolTip="{Binding Result.Title}" x:Name="Title"
|
||||
VerticalAlignment="Center" ToolTip="{Binding ShowTitleToolTip}" x:Name="Title"
|
||||
Text="{Binding Result.Title}">
|
||||
<vm:ResultsViewModel.FormattedText>
|
||||
<MultiBinding Converter="{StaticResource HighlightTextConverter}">
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
</MultiBinding>
|
||||
</vm:ResultsViewModel.FormattedText>
|
||||
</TextBlock>
|
||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding Result.SubTitle}"
|
||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding ShowSubTitleToolTip}"
|
||||
Grid.Row="1" x:Name="SubTitle" Text="{Binding Result.SubTitle}" MinWidth="750">
|
||||
<vm:ResultsViewModel.FormattedText>
|
||||
<MultiBinding Converter="{StaticResource HighlightTextConverter}">
|
||||
|
|
|
|||
|
|
@ -29,6 +29,14 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public string OpenResultModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip)
|
||||
? Result.Title
|
||||
: Result.TitleToolTip;
|
||||
|
||||
public string ShowSubTitleToolTip => string.IsNullOrEmpty(Result.SubTitleToolTip)
|
||||
? Result.SubTitle
|
||||
: Result.SubTitleToolTip;
|
||||
|
||||
public ImageSource Image
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
try
|
||||
{
|
||||
Process.Start("explorer.exe", $" /select,\"{record.FullPath}\"");
|
||||
FilesFolders.OpenContainingFolder(record.FullPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
internal const string DifferentUserIconImagePath = "Images\\user.png";
|
||||
internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png";
|
||||
|
||||
internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
|
||||
internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory";
|
||||
|
||||
internal const string ToolTipOpenContainingFolder = "Ctrl + Enter to open the containing folder";
|
||||
|
||||
internal const char AllFilesFolderSearchWildcard = '>';
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo
|
|||
|
||||
if (fileSystemInfo is System.IO.DirectoryInfo)
|
||||
{
|
||||
folderList.Add(resultManager.CreateFolderResult(fileSystemInfo.Name, Constants.DefaultFolderSubtitleString, fileSystemInfo.FullName, query, true, false));
|
||||
folderList.Add(resultManager.CreateFolderResult(fileSystemInfo.Name, fileSystemInfo.FullName, fileSystemInfo.FullName, query, true, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
|||
return folderLinks
|
||||
.Select(item =>
|
||||
new ResultManager(context)
|
||||
.CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query))
|
||||
.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
||||
.ToList();
|
||||
|
||||
string search = query.Search.ToLower();
|
||||
|
|
@ -21,7 +21,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
|||
|
||||
return queriedFolderLinks.Select(item =>
|
||||
new ResultManager(context)
|
||||
.CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query))
|
||||
.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
|
@ -38,13 +39,15 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
|
||||
context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
|
||||
changeTo :
|
||||
query.ActionKeyword + " " + changeTo);
|
||||
return false;
|
||||
},
|
||||
TitleToolTip = Constants.ToolTipOpenDirectory,
|
||||
SubTitleToolTip = Constants.ToolTipOpenDirectory,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed }
|
||||
};
|
||||
}
|
||||
|
|
@ -85,6 +88,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
FilesFolders.OpenPath(retrievedDirectoryPath);
|
||||
return true;
|
||||
},
|
||||
TitleToolTip = retrievedDirectoryPath,
|
||||
SubTitleToolTip = retrievedDirectoryPath,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = retrievedDirectoryPath, ShowIndexState = true, WindowsIndexed = windowsIndexed }
|
||||
};
|
||||
}
|
||||
|
|
@ -101,7 +106,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
{
|
||||
try
|
||||
{
|
||||
FilesFolders.OpenPath(filePath);
|
||||
if (c.SpecialKeyState.CtrlPressed)
|
||||
{
|
||||
FilesFolders.OpenContainingFolder(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
FilesFolders.OpenPath(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -110,6 +122,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
return true;
|
||||
},
|
||||
TitleToolTip = Constants.ToolTipOpenContainingFolder,
|
||||
SubTitleToolTip = Constants.ToolTipOpenContainingFolder,
|
||||
ContextData = new SearchResult { Type = ResultType.File, FullPath = filePath, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed }
|
||||
};
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
|||
if (dataReaderResults.GetString(2) == "Directory")
|
||||
{
|
||||
folderResults.Add(resultManager.CreateFolderResult(
|
||||
dataReaderResults.GetString(0),
|
||||
Constants.DefaultFolderSubtitleString,
|
||||
dataReaderResults.GetString(0),
|
||||
dataReaderResults.GetString(1),
|
||||
dataReaderResults.GetString(1),
|
||||
query, true, true));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue