Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
155eecd
Expose part functions to helper
Jack251970 Jun 4, 2025
1655139
Add ui for new setting
Jack251970 Jun 4, 2025
f069ee9
Show more info in file & folder tooltip
Jack251970 Jun 4, 2025
85c0387
Support custom preview panel for folder results
Jack251970 Jun 4, 2025
ce07299
Add try-catch for tooltip getter
Jack251970 Jun 4, 2025
b1557dd
Add try-catch for preview panel operation
Jack251970 Jun 4, 2025
edb4d74
Add timeout for folder size calculation
Jack251970 Jun 4, 2025
f2a7536
Use EnumerateFiles instead of GetFiles
Jack251970 Jun 4, 2025
32b75b4
Fix CancellationTokenSource dispose state
Jack251970 Jun 4, 2025
4e4707a
Merge branch 'dev' into file_tooltip
Jack251970 Jun 4, 2025
4cd0891
Merge branch 'dev' into file_tooltip
Jack251970 Jun 5, 2025
e61151d
Improve preview panel performance
Jack251970 Jun 5, 2025
19061df
Use concurrent version
Jack251970 Jun 5, 2025
617c62f
Add error log message
Jack251970 Jun 5, 2025
14ffe3c
Handle more exceptions
Jack251970 Jun 5, 2025
1a95632
Handle AggregateException
Jack251970 Jun 5, 2025
4c7a4fe
Add more info tooltip support for volumes
Jack251970 Jun 5, 2025
ed064fb
Merge branch 'dev' into file_tooltip
Jack251970 Jun 5, 2025
abe287f
Add MMM date format
Jack251970 Jun 6, 2025
407ad03
Merge branch 'dev' into file_tooltip
Jack251970 Jun 6, 2025
82f3e99
Revert changes in ExplorerSettings.xaml
Jack251970 Jun 6, 2025
d0c240f
Merge branch 'dev' into file_tooltip
Jack251970 Jun 6, 2025
475db2b
Add blank line back
Jack251970 Jun 6, 2025
a04829b
Add setting ui back
Jack251970 Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<system:String x:Key="plugin_explorer_shell_path">Shell Path</system:String>
<system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String>
<system:String x:Key="plugin_explorer_use_location_as_working_dir">Use search result's location as the working directory of the executable</system:String>
<system:String x:Key="plugin_explorer_display_more_info_in_tooltip">Display more information like size and age in tooltips</system:String>
<system:String x:Key="plugin_explorer_default_open_in_file_manager">Hit Enter to open folder in Default File Manager</system:String>
<system:String x:Key="plugin_explorer_usewindowsindexfordirectorysearch">Use Index Search For Path Search</system:String>
<system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String>
Expand Down Expand Up @@ -79,6 +80,9 @@
<!-- Plugin Tooltip -->
<system:String x:Key="plugin_explorer_plugin_ToolTipOpenDirectory">Ctrl + Enter to open the directory</system:String>
<system:String x:Key="plugin_explorer_plugin_ToolTipOpenContainingFolder">Ctrl + Enter to open the containing folder</system:String>
<system:String x:Key="plugin_explorer_plugin_tooltip_more_info">{0}{4}Size: {1}{4}Date created: {2}{4}Date modified: {3}</system:String>
<system:String x:Key="plugin_explorer_plugin_tooltip_more_info_unknown">Unknown</system:String>
<system:String x:Key="plugin_explorer_plugin_tooltip_more_info_volume">{0}{3}Space free: {1}{3}Total size: {2}</system:String>

<!-- Context menu items -->
<system:String x:Key="plugin_explorer_copypath">Copy path</system:String>
Expand Down
62 changes: 52 additions & 10 deletions Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
{
public static class ResultManager
{
private static readonly string ClassName = nameof(ResultManager);

private static readonly string[] SizeUnits = { "B", "KB", "MB", "GB", "TB" };
private static PluginInitContext Context;
private static Settings Settings { get; set; }
Expand Down Expand Up @@ -99,10 +101,7 @@
AutoCompleteText = GetAutoCompleteText(title, query, path, ResultType.Folder),
TitleHighlightData = Context.API.FuzzySearch(query.Search, title).MatchData,
CopyText = path,
Preview = new Result.PreviewInfo
{
FilePath = path,
},
PreviewPanel = new Lazy<UserControl>(() => new PreviewPanel(Settings, path, ResultType.Folder)),
Action = c =>
{
if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt)
Expand Down Expand Up @@ -134,7 +133,7 @@
}
catch (Exception ex)
{
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));

Check warning on line 136 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`opendir` is not a recognized word. (unrecognized-spelling)
return false;
}
}
Expand All @@ -149,7 +148,7 @@
}
catch (Exception ex)
{
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));

Check warning on line 151 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`opendir` is not a recognized word. (unrecognized-spelling)
return false;
}
}
Expand All @@ -163,7 +162,7 @@
},
Score = score,
TitleToolTip = Main.Context.API.GetTranslation("plugin_explorer_plugin_ToolTipOpenDirectory"),
SubTitleToolTip = path,
SubTitleToolTip = Settings.DisplayMoreInformationInToolTip ? GetFolderMoreInfoTooltip(path) : path,
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, WindowsIndexed = windowsIndexed }
};
}
Expand All @@ -174,16 +173,20 @@
var title = string.Empty; // hide title when use progress bar,
var driveLetter = path[..1].ToUpper();
DriveInfo drv = new DriveInfo(driveLetter);
var freespace = ToReadableSize(drv.AvailableFreeSpace, 2);

Check warning on line 176 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`drv` is not a recognized word. (unrecognized-spelling)
var totalspace = ToReadableSize(drv.TotalSize, 2);

Check warning on line 177 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`drv` is not a recognized word. (unrecognized-spelling)
var subtitle = string.Format(Context.API.GetTranslation("plugin_explorer_diskfreespace"), freespace, totalspace);

Check warning on line 178 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`totalspace` is not a recognized word. (unrecognized-spelling)
double usingSize = (Convert.ToDouble(drv.TotalSize) - Convert.ToDouble(drv.AvailableFreeSpace)) / Convert.ToDouble(drv.TotalSize) * 100;

Check warning on line 179 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`drv` is not a recognized word. (unrecognized-spelling)

Check warning on line 179 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`drv` is not a recognized word. (unrecognized-spelling)

int? progressValue = Convert.ToInt32(usingSize);

if (progressValue >= 90)
progressBarColor = "#da2626";

var tooltip = Settings.DisplayMoreInformationInToolTip
? GetVolumeMoreInfoTooltip(path, freespace, totalspace)

Check warning on line 187 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`totalspace` is not a recognized word. (unrecognized-spelling)
: path;

return new Result
{
Title = title,
Expand All @@ -202,8 +205,8 @@
OpenFolder(path);
return true;
},
TitleToolTip = path,
SubTitleToolTip = path,
TitleToolTip = tooltip,
SubTitleToolTip = tooltip,
ContextData = new SearchResult { Type = ResultType.Volume, FullPath = path, WindowsIndexed = windowsIndexed }
};
}
Expand Down Expand Up @@ -245,7 +248,7 @@
return new Result
{
Title = Context.API.GetTranslation("plugin_explorer_openresultfolder"),
SubTitle = Context.API.GetTranslation("plugin_explorer_openresultfolder_subtitle"),

Check warning on line 251 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`openresultfolder` is not a recognized word. (unrecognized-spelling)
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
IcoPath = folderPath,
Score = 500,
Expand All @@ -269,7 +272,6 @@
bool isMedia = IsMedia(Path.GetExtension(filePath));
var title = Path.GetFileName(filePath);


/* Preview Detail */

var result = new Result
Expand All @@ -287,7 +289,7 @@
TitleHighlightData = Context.API.FuzzySearch(query.Search, title).MatchData,
Score = score,
CopyText = filePath,
PreviewPanel = new Lazy<UserControl>(() => new PreviewPanel(Settings, filePath)),
PreviewPanel = new Lazy<UserControl>(() => new PreviewPanel(Settings, filePath, ResultType.File)),
Action = c =>
{
if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt)
Expand Down Expand Up @@ -318,7 +320,7 @@
return true;
},
TitleToolTip = Main.Context.API.GetTranslation("plugin_explorer_plugin_ToolTipOpenContainingFolder"),
SubTitleToolTip = filePath,
SubTitleToolTip = Settings.DisplayMoreInformationInToolTip ? GetFileMoreInfoTooltip(filePath) : filePath,
ContextData = new SearchResult { Type = ResultType.File, FullPath = filePath, WindowsIndexed = windowsIndexed }
};
return result;
Expand Down Expand Up @@ -349,6 +351,46 @@
_ = Task.Run(() => EverythingApi.IncrementRunCounterAsync(fileOrFolder));
}

private static string GetFileMoreInfoTooltip(string filePath)
{
try
{
var fileSize = PreviewPanel.GetFileSize(filePath);
var fileCreatedAt = PreviewPanel.GetFileCreatedAt(filePath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
var fileModifiedAt = PreviewPanel.GetFileLastModifiedAt(filePath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info"),
filePath, fileSize, fileCreatedAt, fileModifiedAt, Environment.NewLine);
}
catch (Exception e)
{
Context.API.LogException(ClassName, $"Failed to load tooltip for {filePath}", e);
return filePath;
}
}

private static string GetFolderMoreInfoTooltip(string folderPath)
{
try
{
var folderSize = PreviewPanel.GetFolderSize(folderPath);
var folderCreatedAt = PreviewPanel.GetFolderCreatedAt(folderPath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
var folderModifiedAt = PreviewPanel.GetFolderLastModifiedAt(folderPath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info"),
folderPath, folderSize, folderCreatedAt, folderModifiedAt, Environment.NewLine);
}
catch (Exception e)
{
Context.API.LogException(ClassName, $"Failed to load tooltip for {folderPath}", e);
return folderPath;
}
}

private static string GetVolumeMoreInfoTooltip(string volumePath, string freespace, string totalspace)

Check warning on line 388 in Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`totalspace` is not a recognized word. (unrecognized-spelling)
{
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_volume"),
volumePath, freespace, totalspace, Environment.NewLine);
}

private static readonly string[] MediaExtensions = { ".jpg", ".png", ".avi", ".mkv", ".bmp", ".gif", ".wmv", ".mp3", ".flac", ".mp4" };
}

Expand Down
2 changes: 2 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class Settings

public bool DefaultOpenFolderInFileManager { get; set; } = false;

public bool DisplayMoreInformationInToolTip { get; set; } = false;

public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;

public bool SearchActionKeywordEnabled { get; set; } = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,21 @@ public string PreviewPanelTimeFormat
"yyyy-MM-dd",
"yyyy-MM-dd ddd",
"yyyy-MM-dd, dddd",
"dd/MMM/yyyy",
"dd/MMM/yyyy ddd",
"dd/MMM/yyyy, dddd",
"dd-MMM-yyyy",
"dd-MMM-yyyy ddd",
"dd-MMM-yyyy, dddd",
"dd.MMM.yyyy",
"dd.MMM.yyyy ddd",
"dd.MMM.yyyy, dddd",
"MMM/dd/yyyy",
"MMM/dd/yyyy ddd",
"MMM/dd/yyyy, dddd",
"yyyy-MMM-dd",
"yyyy-MMM-dd ddd",
"yyyy-MMM-dd, dddd",
};

#endregion
Expand Down
Loading
Loading