mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[Run] Open in console functionality (#4739)
* Added open in console for indexer * Added open in console fpr indexer and folder plugin * Added open in console to program plugin * Added string localization for program plugin * Added test for win32 program * Added test for win32 programs * Added test for indexer plugin * Localization for context menu title * Added tests for folder plugin * Added tests for indexer plugin * Code cleanup * Improved logging and nit fixes * Updated tooltip for open in console * Updates tests * Removed subtitle property from contextmenuresult class * Improved logging for context menu loaders
This commit is contained in:
committed by
GitHub
parent
e3e6b23b7c
commit
638cd1dd48
@@ -8,6 +8,7 @@ using Wox.Plugin;
|
||||
using Microsoft.Plugin.Indexer.SearchHelper;
|
||||
using System.Windows.Input;
|
||||
using System.Reflection;
|
||||
using Wox.Infrastructure;
|
||||
|
||||
namespace Microsoft.Plugin.Indexer
|
||||
{
|
||||
@@ -38,14 +39,12 @@ namespace Microsoft.Plugin.Indexer
|
||||
contextMenus.Add(CreateOpenContainingFolderResult(record));
|
||||
}
|
||||
|
||||
var fileOrFolder = (type == ResultType.File) ? "file" : "folder";
|
||||
contextMenus.Add(new ContextMenuResult
|
||||
{
|
||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||
Title = _context.API.GetTranslation("Microsoft_plugin_indexer_copy_path"),
|
||||
Glyph = "\xE8C8",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
SubTitle = $"Copy the current {fileOrFolder} path to clipboard",
|
||||
AcceleratorKey = Key.C,
|
||||
AcceleratorModifiers = ModifierKeys.Control,
|
||||
|
||||
@@ -65,6 +64,37 @@ namespace Microsoft.Plugin.Indexer
|
||||
}
|
||||
}
|
||||
});
|
||||
contextMenus.Add(new ContextMenuResult
|
||||
{
|
||||
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
|
||||
Title = _context.API.GetTranslation("Microsoft_plugin_indexer_open_in_console"),
|
||||
Glyph = "\xE756",
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
AcceleratorKey = Key.C,
|
||||
AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
|
||||
|
||||
Action = (context) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type == ResultType.File)
|
||||
{
|
||||
Helper.OpenInConsole(Path.GetDirectoryName(record.Path));
|
||||
}
|
||||
else
|
||||
{
|
||||
Helper.OpenInConsole(record.Path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception($"|Microsoft.Plugin.Indexer.ContextMenuLoader.LoadContextMenus| Failed to open {record.Path} in console, {e.Message}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return contextMenus;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<system:String x:Key="Microsoft_plugin_indexer_copy_path">Copy path (Ctrl+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_containing_folder">Open containing folder (Ctrl+Shift+E)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_open_in_console">Open path in console (Ctrl+Shift+C)</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_name">Name</system:String>
|
||||
<system:String x:Key="Microsoft_plugin_indexer_path">Path</system:String>
|
||||
|
||||
|
||||
@@ -58,6 +58,12 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Wox.Test</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Languages\de.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -95,6 +101,4 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user