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);
|
public void OpenDirectory(string DirectoryPath, string FileName = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the URL. The browser and mode used is based on what's configured in Flow's default browser settings.
|
/// Opens the URL with the given Uri object.
|
||||||
/// Also supports application URIs e.g. obsidian://search-query-example
|
/// 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>
|
/// </summary>
|
||||||
public void OpenUrl(string url, bool? inPrivate = null);
|
public void OpenUrl(string url, bool? inPrivate = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public void OpenAppUri(string appUri);
|
public void OpenAppUri(string appUri);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,9 +209,8 @@ namespace Flow.Launcher
|
||||||
explorer.Start();
|
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)
|
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
|
||||||
{
|
{
|
||||||
var browserInfo = _settingsVM.Settings.CustomBrowser;
|
var browserInfo = _settingsVM.Settings.CustomBrowser;
|
||||||
|
|
@ -220,33 +219,43 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
if (browserInfo.OpenInTab)
|
if (browserInfo.OpenInTab)
|
||||||
{
|
{
|
||||||
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||||
}
|
}
|
||||||
else
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenAppUri(url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenUrl(string url, bool? inPrivate = null)
|
public void OpenUrl(string url, bool? inPrivate = null)
|
||||||
|
{
|
||||||
|
OpenUri(new Uri(url), inPrivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenUrl(Uri url, bool? inPrivate = null)
|
||||||
{
|
{
|
||||||
OpenUri(url, inPrivate);
|
OpenUri(url, inPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenAppUri(string appUri)
|
public void OpenAppUri(string appUri)
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo()
|
OpenUri(new Uri(appUri));
|
||||||
{
|
}
|
||||||
FileName = appUri,
|
|
||||||
UseShellExecute = true
|
|
||||||
})?.Dispose();
|
|
||||||
|
|
||||||
return;
|
public void OpenAppUri(Uri appUri)
|
||||||
|
{
|
||||||
|
OpenUri(appUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue