Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "",

try
{
Process.Start(psi);
Process.Start(psi)?.Dispose();
}
catch (System.ComponentModel.Win32Exception)
{
Expand Down Expand Up @@ -100,7 +100,7 @@ public static void OpenInBrowserTab(this string url, string browserPath = "", bo
psi.FileName = url;
}

Process.Start(psi);
Process.Start(psi)?.Dispose();
}
// This error may be thrown if browser path is incorrect
catch (System.ComponentModel.Win32Exception)
Expand Down
31 changes: 20 additions & 11 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,28 @@ public void OpenDirectory(string DirectoryPath, string FileName = null)

public void OpenUrl(string url, bool? inPrivate = null)
{
var browserInfo = _settingsVM.Settings.CustomBrowser;

var path = browserInfo.Path == "*" ? "" : browserInfo.Path;

if (browserInfo.OpenInTab)
var uri = new Uri(url);
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
{
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
}
else
{
url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
var browserInfo = _settingsVM.Settings.CustomBrowser;

var path = browserInfo.Path == "*" ? "" : browserInfo.Path;

if (browserInfo.OpenInTab)
{
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
}
else
{
url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
}
return;
}

Process.Start(new ProcessStartInfo()
{
FileName = url, UseShellExecute = true
})?.Dispose();
}

public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
Expand Down Expand Up @@ -254,4 +263,4 @@ private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, Spe

#endregion
}
}
}