From a2cd48fa5db370cfada9b700573a1a65114bc945 Mon Sep 17 00:00:00 2001 From: David Brett Date: Thu, 9 Apr 2026 21:29:19 +0200 Subject: [PATCH 1/3] Add Extra Args option to browser settings - added new prop ExtraArgs to CustomBrowserViewModel - add new row in SelectBrowserWindow to edit this - Update OpenInBrowserWindow and OpenInBrowserTab to pass along these extra arguments --- .../UserSettings/CustomBrowserViewModel.cs | 2 ++ .../SharedCommands/SearchWeb.cs | 13 ++++++++---- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/PublicAPIInstance.cs | 6 +++--- Flow.Launcher/SelectBrowserWindow.xaml | 20 +++++++++++++++++-- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs b/Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs index 009b27666e8..6bfdefa98cc 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs @@ -10,6 +10,7 @@ public class CustomBrowserViewModel : BaseModel public string DisplayName => Name == "Default" ? Localize.defaultBrowser_default() : Name; public string Path { get; set; } public string PrivateArg { get; set; } + public string ExtraArgs { get; set; } public bool EnablePrivate { get; set; } public bool OpenInTab { get; set; } = true; [JsonIgnore] @@ -24,6 +25,7 @@ public CustomBrowserViewModel Copy() Path = Path, OpenInTab = OpenInTab, PrivateArg = PrivateArg, + ExtraArgs = ExtraArgs, EnablePrivate = EnablePrivate, Editable = Editable }; diff --git a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs index ed3e91daf43..aa18d83ffb9 100644 --- a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs +++ b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs @@ -38,7 +38,7 @@ private static string GetDefaultBrowserPath() /// 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 OpenInBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "") + public static void OpenInBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "", string extraArgs = "") { browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath; @@ -52,7 +52,10 @@ public static void OpenInBrowserWindow(this string url, string 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 ") + (inPrivate ? $"{privateArg} " : "") + url; + var browserArguements = (browserExecutableName == "iexplore.exe" ? "" : "--new-window ") + + (inPrivate ? $"{privateArg} " : "") + + (string.IsNullOrWhiteSpace(extraArgs) ? "" : $"{extraArgs} ") + + url; var psi = new ProcessStartInfo { @@ -86,7 +89,7 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "", /// /// Opens search as a tab in the default browser chosen in Windows settings. /// - public static void OpenInBrowserTab(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "") + public static void OpenInBrowserTab(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "", string extraArgs = "") { browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath; @@ -99,7 +102,9 @@ public static void OpenInBrowserTab(this string url, string browserPath = "", bo if (!string.IsNullOrEmpty(browserPath)) { psi.FileName = browserPath; - psi.Arguments = (inPrivate ? $"{privateArg} " : "") + url; + psi.Arguments = (inPrivate ? $"{privateArg} " : "") + + (string.IsNullOrWhiteSpace(extraArgs) ? "" : $"{extraArgs} ") + + url; } else { diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 02c7becacca..cde09f9915a 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -518,6 +518,7 @@ New Window New Tab Private Mode + Extra Args Default New Profile diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index b939cfb5a5e..67c654b4cfa 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -454,17 +454,17 @@ private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrowser = false) { if (browserInfo.OpenInTab) { - uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); + uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, browserInfo.ExtraArgs); } else { - uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); + uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, browserInfo.ExtraArgs); } } catch (Exception e) { var tabOrWindow = browserInfo.OpenInTab ? "tab" : "window"; - LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}", e); + LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}, {browserInfo.ExtraArgs}", e); ShowMsgError( Localize.errorTitle(), Localize.browserOpenError() diff --git a/Flow.Launcher/SelectBrowserWindow.xaml b/Flow.Launcher/SelectBrowserWindow.xaml index 8af33206cd8..8cd33de8138 100644 --- a/Flow.Launcher/SelectBrowserWindow.xaml +++ b/Flow.Launcher/SelectBrowserWindow.xaml @@ -126,6 +126,7 @@ + @@ -230,6 +231,21 @@ + + From 246910c76295d60e071fc4221631de8e114834d6 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 10 Apr 2026 13:00:24 +0200 Subject: [PATCH 2/3] fix: omit ExtraArgs from logs but add message to show when included --- Flow.Launcher/PublicAPIInstance.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 67c654b4cfa..b2c6230ea56 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -464,7 +464,11 @@ private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrowser = false) catch (Exception e) { var tabOrWindow = browserInfo.OpenInTab ? "tab" : "window"; - LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}, {browserInfo.ExtraArgs}", e); + string includesExtraArgs = string.IsNullOrWhiteSpace(browserInfo.ExtraArgs) + ? "" + : ", [including omitted Extra Args]"; + + LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}{includesExtraArgs}", e); ShowMsgError( Localize.errorTitle(), Localize.browserOpenError() From faf8ab52febc97a9beecca1f97cbde0c6af6edae Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 16 Apr 2026 15:45:14 +0800 Subject: [PATCH 3/3] Improve code quality & Fix typos --- Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs | 4 ++-- Flow.Launcher/PublicAPIInstance.cs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs index aa18d83ffb9..1b4f780a372 100644 --- a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs +++ b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs @@ -52,7 +52,7 @@ public static void OpenInBrowserWindow(this string url, string 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 browserArguments = (browserExecutableName == "iexplore.exe" ? "" : "--new-window ") + (inPrivate ? $"{privateArg} " : "") + (string.IsNullOrWhiteSpace(extraArgs) ? "" : $"{extraArgs} ") + url; @@ -60,7 +60,7 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "", var psi = new ProcessStartInfo { FileName = browser, - Arguments = browserArguements, + Arguments = browserArguments, UseShellExecute = true }; diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index b2c6230ea56..5cefd2298cb 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -464,10 +464,9 @@ private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrowser = false) catch (Exception e) { var tabOrWindow = browserInfo.OpenInTab ? "tab" : "window"; - string includesExtraArgs = string.IsNullOrWhiteSpace(browserInfo.ExtraArgs) + var includesExtraArgs = string.IsNullOrWhiteSpace(browserInfo.ExtraArgs) ? "" : ", [including omitted Extra Args]"; - LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}{includesExtraArgs}", e); ShowMsgError( Localize.errorTitle(),