diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index c98bc0571..e7dd214e9 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -283,8 +283,14 @@ namespace Flow.Launcher.Plugin.Explorer if (record.Type is ResultType.File or ResultType.Folder && Settings.ShowInlinedWindowsContextMenu) { - var filters = Settings - .WindowsContextMenuIgnoredItems + var includedItems = Settings + .WindowsContextMenuIncludedItems + .Replace("\r", "") + .Split("\n") + .Where(v => !string.IsNullOrWhiteSpace(v)) + .ToArray(); + var excludedItems = Settings + .WindowsContextMenuExcludedItems .Replace("\r", "") .Split("\n") .Where(v => !string.IsNullOrWhiteSpace(v)) @@ -292,9 +298,12 @@ namespace Flow.Launcher.Plugin.Explorer var menuItems = ShellContextMenuDisplayHelper .GetContextMenuWithIcons(record.FullPath) .Where(contextMenuItem => - filters.Length == 0 || !filters.Any(filter => + (includedItems.Length == 0 || includedItems.Any(filter => contextMenuItem.Label.Contains(filter, StringComparison.OrdinalIgnoreCase) - ) + )) && + (excludedItems.Length == 0 || !excludedItems.Any(filter => + contextMenuItem.Label.Contains(filter, StringComparison.OrdinalIgnoreCase) + )) ); foreach (var menuItem in menuItems) { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index e00d54bb4..bc1c28adc 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -155,5 +155,6 @@ Native Context Menu Display native context menu - Below you can specify items you want to exclude from context menu, they can be partial (e.g. 'pen wit') or complete ('Open with') + Below you can specify items you want to include in the context menu, they can be partial (e.g. 'pen wit') or complete ('Open with'). + Below you can specify items you want to exclude from context menu, they can be partial (e.g. 'pen wit') or complete ('Open with') diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 627765ca1..c580a54b1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -30,7 +30,9 @@ namespace Flow.Launcher.Plugin.Explorer public bool ShowInlinedWindowsContextMenu { get; set; } = false; - public string WindowsContextMenuIgnoredItems { get; set; } = string.Empty; + public string WindowsContextMenuIncludedItems { get; set; } = string.Empty; + + public string WindowsContextMenuExcludedItems { get; set; } = string.Empty; public bool DefaultOpenFolderInFileManager { get; set; } = false; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 3fc721840..418510460 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -114,12 +114,22 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels } } - public string WindowsContextMenuIgnoredItems + public string WindowsContextMenuIncludedItems { - get => Settings.WindowsContextMenuIgnoredItems; + get => Settings.WindowsContextMenuIncludedItems; set { - Settings.WindowsContextMenuIgnoredItems = value; + Settings.WindowsContextMenuIncludedItems = value; + OnPropertyChanged(); + } + } + + public string WindowsContextMenuExcludedItems + { + get => Settings.WindowsContextMenuExcludedItems; + set + { + Settings.WindowsContextMenuExcludedItems = value; OnPropertyChanged(); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 7ed07d87c..a23faf9ea 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -358,17 +358,50 @@ Content="{DynamicResource plugin_explorer_native_context_menu_display_context_menu}" IsChecked="{Binding ShowWindowsContextMenu}" /> - + + + + + + + + + - + + + + + + + +