From dbab7b6ab395a012e515416e6785a4c21349e0d9 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Wed, 8 Dec 2021 21:39:31 -0600 Subject: [PATCH] Optional Inprivate argument & Comment --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 5 ++++- Flow.Launcher/PublicAPIInstance.cs | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index f87ca3969..c5a5231c0 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -213,6 +213,9 @@ namespace Flow.Launcher.Plugin /// Extra FileName Info public void OpenDirectory(string DirectoryPath, string FileName = null); - public void OpenUrl(string url); + /// + /// Open Url in the configured default browser for Flow's Settings. + /// + public void OpenUrl(string url, bool? inPrivate = null); } } diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 46f192a91..f54bc23f0 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -114,7 +114,7 @@ namespace Flow.Launcher var startInfo = ShellCommand.SetProcessStartInfo(filename, arguments: args, createNoWindow: true); ShellCommand.Execute(startInfo); } - + public void CopyToClipboard(string text) { Clipboard.SetDataObject(text); @@ -209,7 +209,7 @@ namespace Flow.Launcher explorer.Start(); } - public void OpenUrl(string url) + public void OpenUrl(string url, bool? inPrivate = null) { var browserInfo = _settingsVM.Settings.CustomBrowser; @@ -217,10 +217,11 @@ namespace Flow.Launcher if (browserInfo.OpenInTab) { - url.OpenInBrowserTab(path, browserInfo.EnablePrivate, browserInfo.PrivateArg); - }else + url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); + } + else { - url.OpenInBrowserWindow(path, browserInfo.EnablePrivate, browserInfo.PrivateArg); + url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); } }