diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs
index 1efc804a07..7a2a3dd1c5 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs
@@ -10,6 +10,7 @@ using Wox.Plugin.SharedCommands;
using Wox.Plugin;
using System.Reflection;
using System.Windows.Input;
+using Wox.Infrastructure;
namespace Microsoft.Plugin.Folder
{
@@ -33,14 +34,12 @@ namespace Microsoft.Plugin.Folder
}
var icoPath = (record.Type == ResultType.File) ? Main.FileImagePath : Main.FolderImagePath;
- var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
contextMenus.Add(new ContextMenuResult
{
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
Title = _context.API.GetTranslation("Microsoft_plugin_folder_copy_path"),
Glyph = "\xE8C8",
FontFamily = "Segoe MDL2 Assets",
- SubTitle = $"Copy the current {fileOrFolder} path to clipboard",
AcceleratorKey = Key.C,
AcceleratorModifiers = ModifierKeys.Control,
Action = (context) =>
@@ -59,6 +58,38 @@ namespace Microsoft.Plugin.Folder
}
}
});
+
+ contextMenus.Add(new ContextMenuResult
+ {
+ PluginName = Assembly.GetExecutingAssembly().GetName().Name,
+ Title = _context.API.GetTranslation("Microsoft_plugin_folder_open_in_console"),
+ Glyph = "\xE756",
+ FontFamily = "Segoe MDL2 Assets",
+ AcceleratorKey = Key.C,
+ AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
+
+ Action = (context) =>
+ {
+ try
+ {
+ if (record.Type == ResultType.File)
+ {
+ Helper.OpenInConsole(Path.GetDirectoryName(record.FullPath));
+ }
+ else
+ {
+ Helper.OpenInConsole(record.FullPath);
+ }
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ Log.Exception($"|Microsoft.Plugin.Folder.ContextMenuLoader.LoadContextMenus| Failed to open {record.FullPath} in console, {e.Message}", e);
+ return false;
+ }
+ }
+ });
}
return contextMenus;
@@ -69,7 +100,7 @@ namespace Microsoft.Plugin.Folder
return new ContextMenuResult
{
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
- Title = "Open containing folder",
+ Title = _context.API.GetTranslation("Microsoft_plugin_folder_open_containing_folder"),
Glyph = "\xE838",
FontFamily = "Segoe MDL2 Assets",
AcceleratorKey = Key.E,
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/de.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/de.xaml
index 11a51de494..58e266c7af 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/de.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/de.xaml
@@ -12,5 +12,6 @@
Ordner
Öffne deine Lieblingsordner direkt von Wox aus
Copy path (Ctrl+C)
-
+ Open path in console (Ctrl+Shift+C)
+ Open containing folder (Ctrl+Shift+E)
\ No newline at end of file
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/en.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/en.xaml
index 5c309300c3..810d1e6031 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/en.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/en.xaml
@@ -12,5 +12,6 @@
Folder
Open favorite folder from Wox directly
Copy path (Ctrl+C)
-
+ Open path in console (Ctrl+Shift+C)
+ Open containing folder (Ctrl+Shift+E)
\ No newline at end of file
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/pl.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/pl.xaml
index 96621c7f11..effc57a9ed 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/pl.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/pl.xaml
@@ -12,5 +12,6 @@
Foldery
Otwórz ulubione foldery bezpośrednio z poziomu Woxa
Copy path (Ctrl+C)
-
+ Open path in console (Ctrl+Shift+C)
+ Open containing folder (Ctrl+Shift+E)
\ No newline at end of file
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/tr.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/tr.xaml
index 8cc3c8f5e7..3761a990ad 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/tr.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/tr.xaml
@@ -12,5 +12,6 @@
Klasör
Favori klasörünüzü doğrudan Wox'tan açın
Copy path (Ctrl+C)
-
+ Open path in console (Ctrl+Shift+C)
+ Open containing folder (Ctrl+Shift+E)
\ No newline at end of file
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-cn.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-cn.xaml
index 494921cb3e..0f5961ef7d 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-cn.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-cn.xaml
@@ -12,5 +12,6 @@
文件夹
在Wox中直接打开收藏的文件夹
Copy path (Ctrl+C)
-
+ Open path in console (Ctrl+Shift+C)
+ Open containing folder (Ctrl+Shift+E)
\ No newline at end of file
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-tw.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-tw.xaml
index f6513579f1..c085fba0e3 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-tw.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Languages/zh-tw.xaml
@@ -12,5 +12,6 @@
資料夾
在 Wox 中直接開啟收藏的資料夾
Copy path (Ctrl+C)
-
+ Open path in console (Ctrl+Shift+C)
+ Open containing folder (Ctrl+Shift+E)
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj
index bc004a5e8e..a65adb0473 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Microsoft.Plugin.Folder.csproj
@@ -42,6 +42,12 @@
PreserveNewest
+
+
+
+ <_Parameter1>Wox.Test
+
+
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs
index 9281e40fd8..a1465db07b 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs
@@ -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;
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/de.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/de.xaml
index 28408b166c..f00dd4e5b2 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/de.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/de.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/en.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/en.xaml
index 28408b166c..9aa0049b2e 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/en.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/en.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/ja.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/ja.xaml
index 28408b166c..9aa0049b2e 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/ja.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/ja.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/pl.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/pl.xaml
index 28408b166c..9aa0049b2e 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/pl.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/pl.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/tr.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/tr.xaml
index 28408b166c..9aa0049b2e 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/tr.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/tr.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-cn.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-cn.xaml
index 28408b166c..9aa0049b2e 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-cn.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-cn.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-tw.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-tw.xaml
index 28408b166c..9aa0049b2e 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-tw.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Languages/zh-tw.xaml
@@ -4,6 +4,7 @@
Copy path (Ctrl+C)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Name
Path
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj
index 2143a86ebf..c41c6568bb 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Microsoft.Plugin.Indexer.csproj
@@ -58,6 +58,12 @@
+
+
+ <_Parameter1>Wox.Test
+
+
+
MSBuild:Compile
@@ -95,6 +101,4 @@
PreserveNewest
-
-
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/de.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/de.xaml
index 40200babb8..534fa04a95 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/de.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/de.xaml
@@ -30,6 +30,7 @@
Als Administrator ausführen (Ctrl+Shift+Enter)
Enthaltenden Ordner öffnen (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
Programm
Suche Programme mit Wox
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/en.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/en.xaml
index 71a24d774a..18eed3c4d6 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/en.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/en.xaml
@@ -35,6 +35,8 @@
Run As Administrator (Ctrl+Shift+Enter)
Open containing folder (Ctrl+Shift+E)
Disable this program from displaying
+ Open path in console (Ctrl+Shift+C)
+
Program
Search programs in Wox
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/ja.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/ja.xaml
index c623a24597..e6e24fd4c7 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/ja.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/ja.xaml
@@ -31,6 +31,8 @@
Run As Administrator (Ctrl+Shift+Enter)
Open containing folder (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
+
Program
Search programs in Wox
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/pl.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/pl.xaml
index ef6b3a0d11..fed3e89c73 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/pl.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/pl.xaml
@@ -33,6 +33,7 @@
Programy
Szukaj i uruchamiaj programy z poziomu Woxa
+ Open path in console (Ctrl+Shift+C)
Application
@@ -43,4 +44,5 @@
Name
Path
+
\ No newline at end of file
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/tr.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/tr.xaml
index 8a3b9b5327..a7549a571c 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/tr.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/tr.xaml
@@ -30,6 +30,8 @@
Yönetici Olarak Çalıştır (Ctrl+Shift+Enter)
İçeren Klasörü Aç (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
+
Program
Programları Wox'tan arayın
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-cn.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-cn.xaml
index 6d62b5df9b..b7a2ffe473 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-cn.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-cn.xaml
@@ -30,6 +30,8 @@
以管理员身份运行 (Ctrl+Shift+Enter)
打开所属文件夹 (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
+
程序
在Wox中搜索程序
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-tw.xaml b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-tw.xaml
index b63b4bf015..6fcc4131cf 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-tw.xaml
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Languages/zh-tw.xaml
@@ -30,6 +30,8 @@
以系統管理員身分執行 (Ctrl+Shift+Enter)
開啟檔案位置 (Ctrl+Shift+E)
+ Open path in console (Ctrl+Shift+C)
+
程式
在 Wox 中搜尋程式
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs
index e28220b677..a266cf8d16 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs
@@ -22,6 +22,7 @@ using System.Runtime.InteropServices.ComTypes;
using Wox.Plugin.SharedCommands;
using System.Reflection;
using Wox.Infrastructure.Image;
+using Wox.Infrastructure.Logger;
namespace Microsoft.Plugin.Program.Programs
{
@@ -356,7 +357,30 @@ namespace Microsoft.Plugin.Program.Programs
return true;
}
});
-
+
+ contextMenus.Add(new ContextMenuResult
+ {
+ PluginName = Assembly.GetExecutingAssembly().GetName().Name,
+ Title = api.GetTranslation("wox_plugin_program_open_in_console"),
+ Glyph = "\xE756",
+ FontFamily = "Segoe MDL2 Assets",
+ AcceleratorKey = Key.C,
+ AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
+ Action = (context) =>
+ {
+ try
+ {
+ Helper.OpenInConsole(Package.Location);
+ return true;
+ }
+ catch (Exception e)
+ {
+ Log.Exception($"|Microsoft.Plugin.Program.UWP.ContextMenu| Failed to open {Name} in console, {e.Message}", e);
+ return false;
+ }
+ }
+ });
+
return contextMenus;
}
diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs
index 80796ee4d2..1414fbed12 100644
--- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs
+++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs
@@ -14,6 +14,7 @@ using Wox.Plugin;
using System.Windows.Input;
using System.Reflection;
using System.Text.RegularExpressions;
+using Wox.Infrastructure.Logger;
namespace Microsoft.Plugin.Program.Programs
{
@@ -202,32 +203,11 @@ namespace Microsoft.Plugin.Program.Programs
public List ContextMenus(IPublicAPI api)
{
- // To add a context menu only to open file location as Internet shortcut applications do not have the functionality to run as admin
- if(AppType == (uint)ApplicationTypes.INTERNET_SHORTCUT_APPLICATION)
+ var contextMenus = new List();
+
+ if (AppType != (uint)ApplicationTypes.INTERNET_SHORTCUT_APPLICATION)
{
- var contextMenuItems = new List
- {
- new ContextMenuResult
- {
- PluginName = Assembly.GetExecutingAssembly().GetName().Name,
- Title = api.GetTranslation("wox_plugin_program_open_containing_folder"),
- Glyph = "\xE838",
- FontFamily = "Segoe MDL2 Assets",
- AcceleratorKey = Key.E,
- AcceleratorModifiers = (ModifierKeys.Control | ModifierKeys.Shift),
- Action = _ =>
- {
- Main.StartProcess(Process.Start, new ProcessStartInfo("explorer", ParentDirectory));
- return true;
- }
- }
- };
- return contextMenuItems;
- }
-
- var contextMenus = new List
- {
- new ContextMenuResult
+ contextMenus.Add(new ContextMenuResult
{
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
Title = api.GetTranslation("wox_plugin_program_run_as_administrator"),
@@ -249,7 +229,10 @@ namespace Microsoft.Plugin.Program.Programs
return true;
}
- },
+ });
+ }
+
+ contextMenus.Add(
new ContextMenuResult
{
PluginName = Assembly.GetExecutingAssembly().GetName().Name,
@@ -263,8 +246,32 @@ namespace Microsoft.Plugin.Program.Programs
Main.StartProcess(Process.Start, new ProcessStartInfo("explorer", ParentDirectory));
return true;
}
- }
- };
+ });
+
+ contextMenus.Add(
+ new ContextMenuResult
+ {
+ PluginName = Assembly.GetExecutingAssembly().GetName().Name,
+ Title = api.GetTranslation("wox_plugin_program_open_in_console"),
+ Glyph = "\xE756",
+ FontFamily = "Segoe MDL2 Assets",
+ AcceleratorKey = Key.C,
+ AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
+ Action = (context) =>
+ {
+ try
+ {
+ Helper.OpenInConsole(ParentDirectory);
+ return true;
+ }
+ catch (Exception e)
+ {
+ Log.Exception($"|Microsoft.Plugin.Program.Win32.ContextMenu| Failed to open {Name} in console, {e.Message}", e);
+ return false;
+ }
+ }
+ });
+
return contextMenus;
}
diff --git a/src/modules/launcher/Wox.Infrastructure/Helper.cs b/src/modules/launcher/Wox.Infrastructure/Helper.cs
index dc31bd70d7..37554e42ef 100644
--- a/src/modules/launcher/Wox.Infrastructure/Helper.cs
+++ b/src/modules/launcher/Wox.Infrastructure/Helper.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics;
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -74,5 +75,16 @@ namespace Wox.Infrastructure
);
return formatted;
}
+
+ public static Process OpenInConsole(string path)
+ {
+ var processStartInfo = new ProcessStartInfo
+ {
+ WorkingDirectory = path,
+ FileName = "cmd.exe"
+ };
+
+ return Process.Start(processStartInfo);
+ }
}
}
diff --git a/src/modules/launcher/Wox.Plugin/ContextMenuResult.cs b/src/modules/launcher/Wox.Plugin/ContextMenuResult.cs
index bc82122c4d..ca97852c52 100644
--- a/src/modules/launcher/Wox.Plugin/ContextMenuResult.cs
+++ b/src/modules/launcher/Wox.Plugin/ContextMenuResult.cs
@@ -7,9 +7,8 @@ namespace Wox.Plugin
public class ContextMenuResult
{
public string PluginName { get; set; }
- public string Title { get; set; }
- public string SubTitle { get; set; }
+ public string Title { get; set; }
public string Glyph { get; set; }
@@ -26,7 +25,7 @@ namespace Wox.Plugin
public override string ToString()
{
- return Title + SubTitle;
+ return Title;
}
}
}
\ No newline at end of file
diff --git a/src/modules/launcher/Wox.Test/Plugins/FolderPluginTest.cs b/src/modules/launcher/Wox.Test/Plugins/FolderPluginTest.cs
new file mode 100644
index 0000000000..5559cee23e
--- /dev/null
+++ b/src/modules/launcher/Wox.Test/Plugins/FolderPluginTest.cs
@@ -0,0 +1,54 @@
+using Moq;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Wox.Plugin;
+using Microsoft.Plugin.Folder;
+
+namespace Wox.Test.Plugins
+{
+ class FolderPluginTest
+ {
+ [Test]
+ public void ContextMenuLoader_ReturnContextMenuForFolderWithOpenInConsole_WhenLoadContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(api => api.GetTranslation(It.IsAny())).Returns(It.IsAny());
+ var pluginInitContext = new PluginInitContext() { API = mock.Object };
+ var contextMenuLoader = new ContextMenuLoader(pluginInitContext);
+ var searchResult = new SearchResult() { Type = ResultType.Folder, FullPath = "C:/DummyFolder" };
+ var result = new Result() { ContextData = searchResult };
+
+ // Act
+ List contextMenuResults = contextMenuLoader.LoadContextMenus(result);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 2);
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_copy_path"), Times.Once());
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_open_in_console"), Times.Once());
+ }
+
+ [Test]
+ public void ContextMenuLoader_ReturnContextMenuForFileWithOpenInConsole_WhenLoadContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(api => api.GetTranslation(It.IsAny())).Returns(It.IsAny());
+ var pluginInitContext = new PluginInitContext() { API = mock.Object };
+ var contextMenuLoader = new ContextMenuLoader(pluginInitContext);
+ var searchResult = new SearchResult() { Type = ResultType.File, FullPath = "C:/DummyFile.cs" };
+ var result = new Result() { ContextData = searchResult };
+
+ // Act
+ List contextMenuResults = contextMenuLoader.LoadContextMenus(result);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 3);
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_open_containing_folder"), Times.Once());
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_copy_path"), Times.Once());
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_open_in_console"), Times.Once());
+ }
+ }
+}
diff --git a/src/modules/launcher/Wox.Test/Plugins/Win32Tests.cs b/src/modules/launcher/Wox.Test/Plugins/Win32Tests.cs
index af5fcf0dfc..f8054e7f68 100644
--- a/src/modules/launcher/Wox.Test/Plugins/Win32Tests.cs
+++ b/src/modules/launcher/Wox.Test/Plugins/Win32Tests.cs
@@ -8,125 +8,142 @@ using Wox.Plugin;
using Microsoft.Plugin.Program.Programs;
using Moq;
using System.IO;
+using Microsoft.Plugin.Program;
+using System.IO.Packaging;
+using Windows.ApplicationModel;
namespace Wox.Test.Plugins
{
[TestFixture]
public class Win32Tests
{
- Win32 notepad_appdata = new Win32
+ static Win32 notepad_appdata = new Win32
{
Name = "Notepad",
ExecutableName = "notepad.exe",
FullPath = "c:\\windows\\system32\\notepad.exe",
- LnkResolvedPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\accessories\\notepad.lnk"
+ LnkResolvedPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\accessories\\notepad.lnk",
+ AppType = 2
};
- Win32 notepad_users = new Win32
+ static Win32 notepad_users = new Win32
{
Name = "Notepad",
ExecutableName = "notepad.exe",
FullPath = "c:\\windows\\system32\\notepad.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\accessories\\notepad.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\accessories\\notepad.lnk",
+ AppType = 2
};
- Win32 azure_command_prompt = new Win32
+ static Win32 azure_command_prompt = new Win32
{
Name = "Microsoft Azure Command Prompt - v2.9",
ExecutableName = "cmd.exe",
FullPath = "c:\\windows\\system32\\cmd.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\microsoft azure\\microsoft azure sdk for .net\\v2.9\\microsoft azure command prompt - v2.9.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\microsoft azure\\microsoft azure sdk for .net\\v2.9\\microsoft azure command prompt - v2.9.lnk",
+ AppType = 2
};
- Win32 visual_studio_command_prompt = new Win32
+ static Win32 visual_studio_command_prompt = new Win32
{
Name = "x64 Native Tools Command Prompt for VS 2019",
ExecutableName = "cmd.exe",
FullPath = "c:\\windows\\system32\\cmd.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\visual studio 2019\\visual studio tools\\vc\\x64 native tools command prompt for vs 2019.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\visual studio 2019\\visual studio tools\\vc\\x64 native tools command prompt for vs 2019.lnk",
+ AppType = 2
};
- Win32 command_prompt = new Win32
+ static Win32 command_prompt = new Win32
{
Name = "Command Prompt",
ExecutableName = "cmd.exe",
FullPath = "c:\\windows\\system32\\cmd.exe",
- LnkResolvedPath ="c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\system tools\\command prompt.lnk"
+ LnkResolvedPath ="c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\system tools\\command prompt.lnk",
+ AppType = 2
};
- Win32 file_explorer = new Win32
+ static Win32 file_explorer = new Win32
{
Name = "File Explorer",
ExecutableName = "File Explorer.lnk",
FullPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\system tools\\file explorer.lnk",
- LnkResolvedPath = null
+ LnkResolvedPath = null,
+ AppType = 2
};
- Win32 wordpad = new Win32
+ static Win32 wordpad = new Win32
{
Name = "Wordpad",
ExecutableName = "wordpad.exe",
FullPath = "c:\\program files\\windows nt\\accessories\\wordpad.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\accessories\\wordpad.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\accessories\\wordpad.lnk",
+ AppType = 2
};
- Win32 wordpad_duplicate = new Win32
+ static Win32 wordpad_duplicate = new Win32
{
Name = "WORDPAD",
ExecutableName = "WORDPAD.EXE",
FullPath = "c:\\program files\\windows nt\\accessories\\wordpad.exe",
- LnkResolvedPath = null
+ LnkResolvedPath = null,
+ AppType = 2
};
- Win32 twitter_pwa = new Win32
+ static Win32 twitter_pwa = new Win32
{
Name = "Twitter",
FullPath = "c:\\program files (x86)\\google\\chrome\\application\\chrome_proxy.exe",
LnkResolvedPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\chrome apps\\twitter.lnk",
- Arguments = " --profile-directory=Default --app-id=jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi"
+ Arguments = " --profile-directory=Default --app-id=jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi",
+ AppType = 0
};
- Win32 pinned_webpage = new Win32
+ static Win32 pinned_webpage = new Win32
{
Name = "Web page",
FullPath = "c:\\program files (x86)\\microsoft\\edge\\application\\msedge_proxy.exe",
LnkResolvedPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\web page.lnk",
- Arguments = "--profile-directory=Default --app-id=homljgmgpmcbpjbnjpfijnhipfkiclkd"
+ Arguments = "--profile-directory=Default --app-id=homljgmgpmcbpjbnjpfijnhipfkiclkd",
+ AppType = 0
};
- Win32 edge_named_pinned_webpage = new Win32
+ static Win32 edge_named_pinned_webpage = new Win32
{
Name = "edge - Bing",
FullPath = "c:\\program files (x86)\\microsoft\\edge\\application\\msedge_proxy.exe",
LnkResolvedPath = "c:\\users\\powertoys\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\edge - bing.lnk",
- Arguments = " --profile-directory=Default --app-id=aocfnapldcnfbofgmbbllojgocaelgdd"
+ Arguments = " --profile-directory=Default --app-id=aocfnapldcnfbofgmbbllojgocaelgdd",
+ AppType = 0
};
- Win32 msedge = new Win32
+ static Win32 msedge = new Win32
{
Name = "Microsoft Edge",
ExecutableName = "msedge.exe",
FullPath = "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\microsoft edge.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\microsoft edge.lnk",
+ AppType = 2
};
- Win32 chrome = new Win32
+ static Win32 chrome = new Win32
{
Name = "Google Chrome",
ExecutableName = "chrome.exe",
FullPath = "c:\\program files (x86)\\google\\chrome\\application\\chrome.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\google chrome.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\google chrome.lnk",
+ AppType = 2
};
- Win32 dummy_proxy_app = new Win32
+ static Win32 dummy_proxy_app = new Win32
{
Name = "Proxy App",
ExecutableName = "test_proxy.exe",
FullPath = "c:\\program files (x86)\\microsoft\\edge\\application\\test_proxy.exe",
- LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\test proxy.lnk"
+ LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\test proxy.lnk",
+ AppType = 2
};
- Win32 cmd_run_command = new Win32
+ static Win32 cmd_run_command = new Win32
{
Name = "cmd",
ExecutableName = "cmd.exe",
@@ -135,7 +152,7 @@ namespace Wox.Test.Plugins
AppType = 3 // Run command
};
- Win32 cmder_run_command = new Win32
+ static Win32 cmder_run_command = new Win32
{
Name = "Cmder",
Description = "Cmder: Lovely Console Emulator",
@@ -145,22 +162,24 @@ namespace Wox.Test.Plugins
AppType = 3 // Run command
};
- Win32 dummy_internetShortcut_app = new Win32
+ static Win32 dummy_internetShortcut_app = new Win32
{
Name = "Shop Titans",
ExecutableName = "Shop Titans.url",
FullPath = "steam://rungameid/1258080",
ParentDirectory = "C:\\Users\\temp\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Steam",
- LnkResolvedPath = null
+ LnkResolvedPath = null,
+ AppType = 1
};
- Win32 dummy_internetShortcut_app_duplicate = new Win32
+ static Win32 dummy_internetShortcut_app_duplicate = new Win32
{
Name = "Shop Titans",
ExecutableName = "Shop Titans.url",
FullPath = "steam://rungameid/1258080",
ParentDirectory = "C:\\Users\\temp\\Desktop",
- LnkResolvedPath = null
+ LnkResolvedPath = null,
+ AppType = 1
};
[Test]
@@ -336,11 +355,77 @@ namespace Wox.Test.Plugins
}
[Test]
- public void Win32Apps_ShouldSetNameAsTitle_WhileCreatingResult()
+ public void WEB_APPLICATION_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled()
{
// Arrange
var mock = new Mock();
mock.Setup(x => x.GetTranslation(It.IsAny())).Returns(It.IsAny());
+
+ // Act
+ List contextMenuResults = pinned_webpage.ContextMenus(mock.Object);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 3);
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_run_as_administrator"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_containing_folder"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_in_console"), Times.Once());
+ }
+
+ [Test]
+ public void INTERNET_SHORTCUT_APPLICATION_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(x => x.GetTranslation(It.IsAny())).Returns(It.IsAny());
+
+ // Act
+ List contextMenuResults = dummy_internetShortcut_app.ContextMenus(mock.Object);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 2);
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_containing_folder"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_in_console"), Times.Once());
+ }
+
+ [Test]
+ public void WIN32_APPLICATION_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(x => x.GetTranslation(It.IsAny())).Returns(It.IsAny());
+
+ // Act
+ List contextMenuResults = chrome.ContextMenus(mock.Object);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 3);
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_run_as_administrator"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_containing_folder"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_in_console"), Times.Once());
+ }
+
+ [Test]
+ public void RUN_COMMAND_ReturnContextMenuWithOpenInConsole_WhenContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(x => x.GetTranslation(It.IsAny())).Returns(It.IsAny());
+
+ // Act
+ List contextMenuResults = cmd_run_command.ContextMenus(mock.Object);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 3);
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_run_as_administrator"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_containing_folder"), Times.Once());
+ mock.Verify(x => x.GetTranslation("wox_plugin_program_open_in_console"), Times.Once());
+ }
+
+ [Test]
+ public void Win32Apps_ShouldSetNameAsTitle_WhileCreatingResult()
+ {
+ var mock = new Mock();
+ mock.Setup(x => x.GetTranslation(It.IsAny())).Returns(It.IsAny());
StringMatcher.Instance = new StringMatcher();
// Act
diff --git a/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs b/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs
index ded997c628..b90e46144a 100644
--- a/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs
+++ b/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs
@@ -7,6 +7,8 @@ using Microsoft.Plugin.Indexer.SearchHelper;
using Microsoft.Plugin.Indexer.Interface;
using Moq;
using System.Linq;
+using Microsoft.Plugin.Indexer;
+using Wox.Plugin;
namespace Wox.Test.Plugins
{
@@ -214,5 +216,46 @@ namespace Wox.Test.Plugins
Assert.IsFalse(windowsSearchAPIResults.Any(x => x.Title == "file1.txt"));
Assert.IsTrue(windowsSearchAPIResults.Any(x => x.Title == "file2.txt"));
}
+
+ [Test]
+ public void ContextMenuLoader_ReturnContextMenuForFolderWithOpenInConsole_WhenLoadContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(api => api.GetTranslation(It.IsAny())).Returns(It.IsAny());
+ var pluginInitContext = new PluginInitContext() { API = mock.Object };
+ var contextMenuLoader = new ContextMenuLoader(pluginInitContext);
+ var searchResult = new SearchResult() { Path = "C:/DummyFolder", Title = "DummyFolder" };
+ var result = new Result() { ContextData = searchResult };
+
+ // Act
+ List contextMenuResults = contextMenuLoader.LoadContextMenus(result);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 2);
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_indexer_copy_path"), Times.Once());
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_indexer_open_in_console"), Times.Once());
+ }
+
+ [Test]
+ public void ContextMenuLoader_ReturnContextMenuForFileWithOpenInConsole_WhenLoadContextMenusIsCalled()
+ {
+ // Arrange
+ var mock = new Mock();
+ mock.Setup(api => api.GetTranslation(It.IsAny())).Returns(It.IsAny());
+ var pluginInitContext = new PluginInitContext() { API = mock.Object };
+ var contextMenuLoader = new ContextMenuLoader(pluginInitContext);
+ var searchResult = new SearchResult() { Path = "C:/DummyFile.cs", Title = "DummyFile.cs" };
+ var result = new Result() { ContextData = searchResult };
+
+ // Act
+ List contextMenuResults = contextMenuLoader.LoadContextMenus(result);
+
+ // Assert
+ Assert.AreEqual(contextMenuResults.Count, 3);
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_indexer_copy_path"), Times.Once());
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_indexer_open_containing_folder"), Times.Once());
+ mock.Verify(x => x.GetTranslation("Microsoft_plugin_indexer_open_in_console"), Times.Once());
+ }
}
}
diff --git a/src/modules/launcher/Wox.Test/Wox.Test.csproj b/src/modules/launcher/Wox.Test/Wox.Test.csproj
index 779cc5b8d3..e4e1d4f00d 100644
--- a/src/modules/launcher/Wox.Test/Wox.Test.csproj
+++ b/src/modules/launcher/Wox.Test/Wox.Test.csproj
@@ -39,6 +39,7 @@
+