diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index bfd2fb0a4..d210ba1d8 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -130,5 +130,15 @@ namespace Flow.Launcher.Plugin /// Plugin ID that generated this result /// public string PluginID { get; internal set; } + + /// + /// Show message as ToolTip on result Title hover over + /// + public string TitleToolTip { get; set; } + + /// + /// Show message as ToolTip on result SubTitle hover over + /// + public string SubTitleToolTip { get; set; } } } \ No newline at end of file diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs index ce067e8a0..98cd777aa 100644 --- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs +++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs @@ -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}\""); + } + /// /// This checks whether a given string is a directory path or network location string. /// It does not check if location actually exists. diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index a8560c263..3280dc457 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -62,7 +62,7 @@ @@ -71,7 +71,7 @@ - diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 0a9731f18..4392234eb 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -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 diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index 90a3fb2e8..89dbb3f88 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -156,7 +156,7 @@ namespace Flow.Launcher.Plugin.Explorer { try { - Process.Start("explorer.exe", $" /select,\"{record.FullPath}\""); + FilesFolders.OpenContainingFolder(record.FullPath); } catch (Exception e) { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs index 9c8a300bc..d474fb0e7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs @@ -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 = '>'; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs index b198395b8..02de0eeae 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs @@ -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 { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs index 689c865c0..ebde039d6 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs @@ -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(); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index e2fd1c7da..6a336c59a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -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; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs index 5401c2845..c1793b42b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs @@ -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)); }