From 07060a8584bd862b1d18e4096b6418378959722b Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 21:27:54 +1000 Subject: [PATCH 1/2] Add shared commands for plugins to use --- Wox.Plugin/SharedCommands/SearchWeb.cs | 27 ++++++++++++++++++++++++++ Wox.Plugin/Wox.Plugin.csproj | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 Wox.Plugin/SharedCommands/SearchWeb.cs diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs new file mode 100644 index 000000000..7c2cc3181 --- /dev/null +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -0,0 +1,27 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Wox.Plugin.WebSearch.Commands +{ + internal static class SearchWeb + { + /// Opens search in a new browser. If no browser path is passed in then Chrome is used. + /// Leave browser path blank to use Chrome. + /// + internal static void NewBrowserWindow(this string url, string browserPath) + { + var browserExecutableName = browserPath? + .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); + + var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; + + // Internet Explorer will open url in new browser window, and does not take the --new-window parameter + var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; + + Process.Start(browser, browserArguements); + } + } +} diff --git a/Wox.Plugin/Wox.Plugin.csproj b/Wox.Plugin/Wox.Plugin.csproj index 1acfef949..8b1e9f0ca 100644 --- a/Wox.Plugin/Wox.Plugin.csproj +++ b/Wox.Plugin/Wox.Plugin.csproj @@ -76,6 +76,7 @@ + @@ -84,6 +85,7 @@ + From 2310d366047641c5e9834dc5b6cfb02da99b7e4e Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 6 Aug 2019 22:00:38 +1000 Subject: [PATCH 2/2] update --- Wox.Plugin/SharedCommands/SearchWeb.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 7c2cc3181..0dc03ee6d 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -3,14 +3,14 @@ using System.Diagnostics; using System.IO; using System.Linq; -namespace Wox.Plugin.WebSearch.Commands +namespace Wox.Plugin.SharedCommands { - internal static class SearchWeb + public static class SearchWeb { /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - internal static void NewBrowserWindow(this string url, string browserPath) + public static void NewBrowserWindow(this string url, string browserPath) { var browserExecutableName = browserPath? .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)