diff --git a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs index 68667f50a..fd1841dda 100644 --- a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs +++ b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs @@ -35,18 +35,21 @@ namespace Flow.Launcher.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 = "", bool inPrivate = false, string privateArg = "") + public static void NewBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "") { browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath; var browserExecutableName = browserPath? - .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last(); + .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 + (inPrivate ? "" : privateArg); + var browserArguements = (browserExecutableName == "iexplore.exe" ? "" : "--new-window ") + (inPrivate ? $" {privateArg}" : "") + url; var psi = new ProcessStartInfo { @@ -61,7 +64,10 @@ namespace Flow.Launcher.Plugin.SharedCommands } catch (System.ComponentModel.Win32Exception) { - Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); + Process.Start(new ProcessStartInfo + { + FileName = url, UseShellExecute = true + }); } } @@ -72,13 +78,16 @@ namespace Flow.Launcher.Plugin.SharedCommands { browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath; - var psi = new ProcessStartInfo() { UseShellExecute = true }; + var psi = new ProcessStartInfo() + { + UseShellExecute = true + }; try { if (!string.IsNullOrEmpty(browserPath)) { psi.FileName = browserPath; - psi.Arguments = url + (inPrivate ? "" : privateArg); + psi.Arguments = (inPrivate ? $"{privateArg} " : "") + url; } else { @@ -90,8 +99,11 @@ namespace Flow.Launcher.Plugin.SharedCommands // This error may be thrown if browser path is incorrect catch (System.ComponentModel.Win32Exception) { - Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); + Process.Start(new ProcessStartInfo + { + FileName = url, UseShellExecute = true + }); } } } -} +} \ No newline at end of file diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 4c93fe3cc..606143bff 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -218,10 +218,10 @@ namespace Flow.Launcher if (browserInfo.OpenInTab) { - SearchWeb.NewTabInBrowser(url, path, browserInfo.EnablePrivate, browserInfo.PrivateArg); + url.NewTabInBrowser(path, browserInfo.EnablePrivate, browserInfo.PrivateArg); }else { - SearchWeb.NewBrowserWindow(url, path, browserInfo.EnablePrivate, browserInfo.PrivateArg); + url.NewBrowserWindow(path, browserInfo.EnablePrivate, browserInfo.PrivateArg); } }