diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index d361df355e8..8a2f8a28724 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -204,6 +204,7 @@ Cycle Previous Query Cycle Next Query Open Context Menu + Open Native Context Menu Open Setting Window Copy File Path Toggle Game Mode diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml index 3f0f8956006..22e3960ef19 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml @@ -5,9 +5,9 @@ xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:flowlauncher="clr-namespace:Flow.Launcher" - xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.modernwpf.com/2019" + xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure" xmlns:viewModels="clr-namespace:Flow.Launcher.SettingPages.ViewModels" Title="Hotkey" d:DataContext="{d:DesignInstance viewModels:SettingsPaneHotkeyViewModel}" @@ -33,9 +33,9 @@ Sub="{DynamicResource flowlauncherHotkeyToolTip}"> @@ -45,17 +45,15 @@ Icon="" Sub="{DynamicResource previewHotkeyToolTip}"> - + - + + + @@ -217,9 +220,9 @@ Sub="{DynamicResource autoCompleteHotkeyToolTip}"> @@ -240,9 +243,9 @@ Icon=""> @@ -263,9 +266,9 @@ Icon=""> @@ -435,8 +438,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index d147aa3308c..43f2b885e7c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -222,34 +222,7 @@ public List LoadContextMenus(Result selectedResult) if (record.Type is ResultType.Volume) return false; - var screenWithMouseCursor = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position); - var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2; - var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2; - var showPosition = new System.Drawing.Point(xOfScreenCenter, yOfScreenCenter); - - switch (record.Type) - { - case ResultType.File: - { - var fileInfos = new FileInfo[] - { - new(record.FullPath) - }; - - new Peter.ShellContextMenu().ShowContextMenu(fileInfos, showPosition); - break; - } - case ResultType.Folder: - { - var directoryInfos = new DirectoryInfo[] - { - new(record.FullPath) - }; - - new Peter.ShellContextMenu().ShowContextMenu(directoryInfos, showPosition); - break; - } - } + ResultManager.ShowNativeContextMenu(record.FullPath, record.Type); return false; }, diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 34f80f55294..71760d0aad2 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -11,6 +11,7 @@ using Path = System.IO.Path; using System.Windows.Controls; using Flow.Launcher.Plugin.Explorer.Views; +using Peter; namespace Flow.Launcher.Plugin.Explorer.Search { @@ -70,6 +71,27 @@ public static Result CreateResult(Query query, SearchResult result) }; } + internal static void ShowNativeContextMenu(string path, ResultType type) + { + var screenWithMouseCursor = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position); + var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2; + var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2; + var showPosition = new System.Drawing.Point(xOfScreenCenter, yOfScreenCenter); + + switch (type) + { + case ResultType.File: + var fileInfo = new FileInfo[] { new(path) }; + new ShellContextMenu().ShowContextMenu(fileInfo, showPosition); + break; + + case ResultType.Folder: + var folderInfo = new System.IO.DirectoryInfo[] { new(path) }; + new ShellContextMenu().ShowContextMenu(folderInfo, showPosition); + break; + } + } + internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false) { return new Result @@ -82,6 +104,11 @@ internal static Result CreateFolderResult(string title, string subtitle, string CopyText = path, Action = c => { + if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt) + { + ShowNativeContextMenu(path, ResultType.Folder); + return false; + } // open folder if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift)) { @@ -218,8 +245,13 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK IcoPath = folderPath, Score = 500, CopyText = folderPath, - Action = _ => + Action = c => { + if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt) + { + ShowNativeContextMenu(folderPath, ResultType.Folder); + return false; + } OpenFolder(folderPath); return true; }, @@ -251,6 +283,11 @@ internal static Result CreateFileResult(string filePath, Query query, int score PreviewPanel = new Lazy(() => new PreviewPanel(Settings, filePath)), Action = c => { + if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt) + { + ShowNativeContextMenu(filePath, ResultType.File); + return false; + } try { if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift))