mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
add overload for using Uri object
This commit is contained in:
parent
96cf9fe36a
commit
95ef8bb458
2 changed files with 37 additions and 15 deletions
|
|
@ -228,13 +228,26 @@ namespace Flow.Launcher.Plugin
|
|||
public void OpenDirectory(string DirectoryPath, string FileName = null);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the URL. The browser and mode used is based on what's configured in Flow's default browser settings.
|
||||
/// Also supports application URIs e.g. obsidian://search-query-example
|
||||
/// Opens the URL with the given Uri object.
|
||||
/// The browser and mode used is based on what's configured in Flow's default browser settings.
|
||||
/// </summary>
|
||||
public void OpenUrl(Uri url, bool? inPrivate = null);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the URL with the given string.
|
||||
/// The browser and mode used is based on what's configured in Flow's default browser settings.
|
||||
/// Non-C# plugins should use this method.
|
||||
/// </summary>
|
||||
public void OpenUrl(string url, bool? inPrivate = null);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the application URI, e.g. obsidian://search-query-example
|
||||
/// Opens the application URI with the given Uri object, e.g. obsidian://search-query-example
|
||||
/// </summary>
|
||||
public void OpenAppUri(Uri appUri);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the application URI with the given string, e.g. obsidian://search-query-example
|
||||
/// Non-C# plugins should use this method
|
||||
/// </summary>
|
||||
public void OpenAppUri(string appUri);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,9 +209,8 @@ namespace Flow.Launcher
|
|||
explorer.Start();
|
||||
}
|
||||
|
||||
private void OpenUri(string url, bool? inPrivate = null)
|
||||
private void OpenUri(Uri uri, bool? inPrivate = null)
|
||||
{
|
||||
var uri = new Uri(url);
|
||||
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
|
||||
{
|
||||
var browserInfo = _settingsVM.Settings.CustomBrowser;
|
||||
|
|
@ -220,33 +219,43 @@ namespace Flow.Launcher
|
|||
|
||||
if (browserInfo.OpenInTab)
|
||||
{
|
||||
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
}
|
||||
else
|
||||
{
|
||||
url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = uri.AbsoluteUri,
|
||||
UseShellExecute = true
|
||||
})?.Dispose();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OpenAppUri(url);
|
||||
}
|
||||
|
||||
public void OpenUrl(string url, bool? inPrivate = null)
|
||||
{
|
||||
OpenUri(new Uri(url), inPrivate);
|
||||
}
|
||||
|
||||
public void OpenUrl(Uri url, bool? inPrivate = null)
|
||||
{
|
||||
OpenUri(url, inPrivate);
|
||||
}
|
||||
|
||||
public void OpenAppUri(string appUri)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = appUri,
|
||||
UseShellExecute = true
|
||||
})?.Dispose();
|
||||
OpenUri(new Uri(appUri));
|
||||
}
|
||||
|
||||
return;
|
||||
public void OpenAppUri(Uri appUri)
|
||||
{
|
||||
OpenUri(appUri);
|
||||
}
|
||||
|
||||
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||
|
|
|
|||
Loading…
Reference in a new issue