From 3e292d7604690ff8fbbf492feb2f2786516d60f8 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 10 Nov 2019 20:12:45 +1100 Subject: [PATCH] Reverse changes made to new browser window call --- Wox.Plugin/SharedCommands/SearchWeb.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index e40c405421..52a79a51b5 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -11,18 +11,25 @@ namespace Wox.Plugin.SharedCommands /// Opens search in a new browser. If no browser path is passed in then Chrome is used. /// Leave browser path blank to use Chrome. /// - public 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) .Last(); - var selectedBrowserPath = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath; + 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" ? "" : "--new-window "; + var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url; - OpenWebSearch(selectedBrowserPath, browserArguements, url); + try + { + Process.Start(browser, browserArguements); + } + catch (System.ComponentModel.Win32Exception) + { + Process.Start(url); + } } ///