Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 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,8 @@
<!-- 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>

<!-- Context menu items -->
<system:String x:Key="plugin_explorer_copypath">Copy path</system:String>
Expand Down
33 changes: 25 additions & 8 deletions Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,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 +131,7 @@
}
catch (Exception ex)
{
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));

Check warning on line 134 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 +146,7 @@
}
catch (Exception ex)
{
Context.API.ShowMsgBox(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));

Check warning on line 149 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 +160,7 @@
},
Score = score,
TitleToolTip = Main.Context.API.GetTranslation("plugin_explorer_plugin_ToolTipOpenDirectory"),
SubTitleToolTip = path,
SubTitleToolTip = Settings.DisplayMoreInformationInToolTip ? GetMoreInfoToolTip(path, ResultType.Folder) : path,
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, WindowsIndexed = windowsIndexed }
};
}
Expand All @@ -174,10 +171,10 @@
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 174 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 175 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 176 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 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)

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)

int? progressValue = Convert.ToInt32(usingSize);

Expand Down Expand Up @@ -245,7 +242,7 @@
return new Result
{
Title = Context.API.GetTranslation("plugin_explorer_openresultfolder"),
SubTitle = Context.API.GetTranslation("plugin_explorer_openresultfolder_subtitle"),

Check warning on line 245 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 +266,6 @@
bool isMedia = IsMedia(Path.GetExtension(filePath));
var title = Path.GetFileName(filePath);


/* Preview Detail */

var result = new Result
Expand All @@ -287,7 +283,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 +314,7 @@
return true;
},
TitleToolTip = Main.Context.API.GetTranslation("plugin_explorer_plugin_ToolTipOpenContainingFolder"),
SubTitleToolTip = filePath,
SubTitleToolTip = Settings.DisplayMoreInformationInToolTip ? GetMoreInfoToolTip(filePath, ResultType.File) : filePath,
ContextData = new SearchResult { Type = ResultType.File, FullPath = filePath, WindowsIndexed = windowsIndexed }
};
return result;
Expand Down Expand Up @@ -349,6 +345,27 @@
_ = Task.Run(() => EverythingApi.IncrementRunCounterAsync(fileOrFolder));
}

private static string GetMoreInfoToolTip(string filePath, ResultType type)
{
switch (type)
{
case ResultType.Folder:
var folderSize = PreviewPanel.GetFolderSize(filePath);
var folderCreatedAt = PreviewPanel.GetFolderCreatedAt(filePath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
var folderModifiedAt = PreviewPanel.GetFolderLastModifiedAt(filePath, Settings.PreviewPanelDateFormat, Settings.PreviewPanelTimeFormat, Settings.ShowFileAgeInPreviewPanel);
return string.Format(Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info"),
filePath, folderSize, folderCreatedAt, folderModifiedAt, Environment.NewLine);
case ResultType.File:
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);
default:
return filePath;
}
}

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
46 changes: 28 additions & 18 deletions Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand All @@ -222,16 +223,25 @@
Content="{DynamicResource plugin_explorer_default_open_in_file_manager}"
IsChecked="{Binding Settings.DefaultOpenFolderInFileManager}" />

<TextBlock
<CheckBox
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
HorizontalAlignment="Left"
Content="{DynamicResource plugin_explorer_display_more_info_in_tooltip}"
IsChecked="{Binding Settings.DisplayMoreInformationInToolTip}" />

<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_file_editor_path}" />
<StackPanel
Grid.Row="2"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Orientation="Horizontal">
Expand All @@ -250,15 +260,15 @@
</StackPanel>

<TextBlock
Grid.Row="3"
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_folder_editor_path}" />
<StackPanel
Grid.Row="3"
Grid.Row="4"
Grid.Column="1"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Orientation="Horizontal">
Expand All @@ -277,15 +287,15 @@
</StackPanel>

<TextBlock
Grid.Row="4"
Grid.Row="5"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_shell_path}" />
<StackPanel
Grid.Row="4"
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Orientation="Horizontal">
Expand All @@ -304,14 +314,14 @@
</StackPanel>

<TextBlock
Grid.Row="5"
Grid.Row="6"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_Index_Search_Engine}" />
<ComboBox
Grid.Row="5"
Grid.Row="6"
Grid.Column="1"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
HorizontalAlignment="Left"
Expand All @@ -321,14 +331,14 @@
SelectedItem="{Binding SelectedIndexSearchEngine}" />

<TextBlock
Grid.Row="6"
Grid.Row="7"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_Content_Search_Engine}" />
<ComboBox
Grid.Row="6"
Grid.Row="7"
Grid.Column="1"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
HorizontalAlignment="Left"
Expand All @@ -338,14 +348,14 @@
SelectedItem="{Binding SelectedContentSearchEngine}" />

<TextBlock
Grid.Row="7"
Grid.Row="8"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_Directory_Recursive_Search_Engine}" />
<ComboBox
Grid.Row="7"
Grid.Row="8"
Grid.Column="1"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
HorizontalAlignment="Left"
Expand All @@ -355,14 +365,14 @@
SelectedItem="{Binding SelectedPathEnumerationEngine}" />

<TextBlock
Grid.Row="8"
Grid.Row="9"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_Excluded_File_Types}" />
<TextBox
Grid.Row="8"
Grid.Row="9"
Grid.Column="1"
MinWidth="{StaticResource SettingPanelTextBoxMinWidth}"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Expand All @@ -371,14 +381,14 @@
ToolTip="{DynamicResource plugin_explorer_Excluded_File_Types_Tooltip}" />

<TextBlock
Grid.Row="9"
Grid.Row="10"
Grid.Column="0"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_Maximum_Results}" />
<TextBox
Grid.Row="9"
Grid.Row="10"
Grid.Column="1"
MinWidth="{StaticResource SettingPanelTextBoxMinWidth}"
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Expand All @@ -390,7 +400,7 @@
ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}" />

<Button
Grid.Row="10"
Grid.Row="11"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
Expand Down Expand Up @@ -488,14 +498,14 @@
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_previewpanel_file_info_label}" />

Check warning on line 501 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`previewpanel` is not a recognized word. (unrecognized-spelling)
<WrapPanel
Width="Auto"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Content="{DynamicResource plugin_explorer_previewpanel_display_file_size_checkbox}"

Check warning on line 508 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`previewpanel` is not a recognized word. (unrecognized-spelling)
IsChecked="{Binding ShowFileSizeInPreviewPanel}" />
<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Expand All @@ -505,7 +515,7 @@
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Content="{DynamicResource plugin_explorer_previewpanel_display_file_modification_checkbox}"
IsChecked="{Binding ShowModifiedDateInPreviewPanel}" />

<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Content="{DynamicResource plugin_explorer_previewpanel_display_file_age_checkbox}"
Expand Down
Loading
Loading