From 4c813301a75b0fa5d9d00ae9d08f4fcffb78095b Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 8 Jun 2024 04:38:06 +0900 Subject: [PATCH] Add Type and Auto Size for context menu --- Flow.Launcher.Plugin/Result.cs | 6 +++ Flow.Launcher/ResultListBox.xaml | 42 ++++++++++++++----- Flow.Launcher/ViewModel/ResultViewModel.cs | 5 +++ .../ContextMenu.cs | 1 + 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index ea79386b3..5a84d2937 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -246,6 +246,12 @@ namespace Flow.Launcher.Plugin return AsyncAction?.Invoke(context) ?? ValueTask.FromResult(Action?.Invoke(context) ?? false); } + /// + /// Item Height Style. Null, Small(for OS Context), Author + /// + public string ItemType { get; set; } + + /// /// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result /// diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 3337b9c93..340d67e82 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -62,13 +62,13 @@ @@ -97,12 +97,12 @@ @@ -173,7 +173,7 @@ + \ No newline at end of file diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 5130e7eba..f29c718f5 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -180,6 +180,11 @@ namespace Flow.Launcher.ViewModel /// public bool UseBigThumbnail => Result.Preview.IsMedia; + public double SmallSize + { + get { return Settings.ItemHeightSize * 0.6; } + } + public GlyphInfo Glyph { get; set; } private async Task LoadImageInternalAsync(string imagePath, Result.IconDelegate icon, bool loadFullImage) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index 9cf0a1857..6a3cdf332 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -301,6 +301,7 @@ namespace Flow.Launcher.Plugin.Explorer { Title = menuItem.Label, Icon = () => menuItem.Icon, + ItemType = "Small", Action = _ => { ShellContextMenuDisplayHelper.ExecuteContextMenuItem(record.FullPath, menuItem.CommandId);