Skip to content

Commit 32107db

Browse files
committed
Support application uri
1 parent b9048f5 commit 32107db

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "",
6060

6161
try
6262
{
63-
Process.Start(psi);
63+
Process.Start(psi)?.Dispose();
6464
}
6565
catch (System.ComponentModel.Win32Exception)
6666
{
@@ -100,7 +100,7 @@ public static void OpenInBrowserTab(this string url, string browserPath = "", bo
100100
psi.FileName = url;
101101
}
102102

103-
Process.Start(psi);
103+
Process.Start(psi)?.Dispose();
104104
}
105105
// This error may be thrown if browser path is incorrect
106106
catch (System.ComponentModel.Win32Exception)

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,28 @@ public void OpenDirectory(string DirectoryPath, string FileName = null)
211211

212212
public void OpenUrl(string url, bool? inPrivate = null)
213213
{
214-
var browserInfo = _settingsVM.Settings.CustomBrowser;
215-
216-
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
217-
218-
if (browserInfo.OpenInTab)
214+
var uri = new Uri(url);
215+
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
219216
{
220-
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
221-
}
222-
else
223-
{
224-
url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
217+
var browserInfo = _settingsVM.Settings.CustomBrowser;
218+
219+
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
220+
221+
if (browserInfo.OpenInTab)
222+
{
223+
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
224+
}
225+
else
226+
{
227+
url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
228+
}
229+
return;
225230
}
226231

232+
Process.Start(new ProcessStartInfo()
233+
{
234+
FileName = url, UseShellExecute = true
235+
})?.Dispose();
227236
}
228237

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

255264
#endregion
256265
}
257-
}
266+
}

0 commit comments

Comments
 (0)