Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Profile support on Bookmarks for Edge browser #2101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
dantesg wants to merge 3 commits into Flow-Launcher:dev
base: dev
Choose a base branch
Loading
from dantesg:bookmark-profiles
Draft
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
Prev Previous commit
Next Next commit
Add additional args to OpenUri()
  • Loading branch information
VictoriousRaptor committed May 12, 2023
commit 2fd646979c4047d112705fc7b2acf7c01bf302e9
12 changes: 2 additions & 10 deletions Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,14 @@ public interface IPublicAPI
/// 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 Uri object.
/// The browser and mode used is based on what's configured in Flow's default browser settings.
/// Non-C# plugins can use this method.
/// </summary>
/// <param name="profileArg">Optional Profile name</param>
public void OpenUrl(string url, bool hasProfile, string profileArg);
public void OpenUrl(Uri url, bool? inPrivate = null, string additionalArgs = "");

/// <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);
public void OpenUrl(string url, bool? inPrivate = null, string additionalArgs = "");

/// <summary>
/// Opens the application URI with the given Uri object, e.g. obsidian://search-query-example
Expand Down
24 changes: 9 additions & 15 deletions Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Win32;
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -35,7 +35,7 @@ private static string GetDefaultBrowserPath()
/// Opens search in a new browser. If no browser path is passed in then Chrome is used.
/// Leave browser path blank to use Chrome.
/// </summary>
public static void OpenInBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "")
public static void OpenInBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "", string additionalArgs = "")
{
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;

Expand All @@ -47,9 +47,10 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "",
.Last();

var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath;

// Internet Explorer will open url in new browser window, and does not take the --new-window parameter
var browserArguements = (browserExecutableName == "iexplore.exe" ? "" : "--new-window ") + (inPrivate ? $"{privateArg} " : "") + url;
var newWindowArg = browserExecutableName == "iexplore.exe" ? "" : "--new-window ";
privateArg = inPrivate && !string.IsNullOrEmpty(privateArg) ? $"{privateArg} " : "";
var browserArguements = $"{newWindowArg}{privateArg}{additionalArgs} {url}";

var psi = new ProcessStartInfo
{
Expand Down Expand Up @@ -80,10 +81,10 @@ public static void NewBrowserWindow(this string url, string browserPath = "")
/// <summary>
/// Opens search as a tab in the default browser chosen in Windows settings.
/// </summary>
public static void OpenInBrowserTab(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "", string profileArg = "")
public static void OpenInBrowserTab(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "", string additionalArgs = "")
{
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;

var psi = new ProcessStartInfo()
{
UseShellExecute = true
Expand All @@ -93,15 +94,8 @@ public static void OpenInBrowserTab(this string url, string browserPath = "", bo
if (!string.IsNullOrEmpty(browserPath))
{
psi.FileName = browserPath;
if (inPrivate)
{
psi.Arguments = (inPrivate ? $"{privateArg} " : "") + url;
}
else
{
psi.Arguments = (!String.IsNullOrEmpty(profileArg) ? $"--profile-directory=\"{profileArg}\" " : "") + url;
}

privateArg = inPrivate && !string.IsNullOrEmpty(privateArg) ? $"{privateArg} " : "";
psi.Arguments = $"{privateArg}{additionalArgs} {url}";
}
else
{
Expand Down
26 changes: 8 additions & 18 deletions Flow.Launcher/PublicAPIInstance.cs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null
explorer.Start();
}

private void OpenUri(Uri uri, bool? inPrivate = null, string profileArg = "")
private void OpenUri(Uri uri, bool? inPrivate = null, string additionalArgs = "")
{
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
{
Expand All @@ -225,11 +225,11 @@ private void OpenUri(Uri uri, bool? inPrivate = null, string profileArg = "")

if (browserInfo.OpenInTab)
{
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, profileArg);
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, additionalArgs);
}
else
{
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, additionalArgs);
}
}
else
Expand All @@ -243,25 +243,15 @@ private void OpenUri(Uri uri, bool? inPrivate = null, string profileArg = "")
return;
}
}
public void OpenUrl(string url, bool hasProfile, string profileArg = "")
{
if (hasProfile)
{
OpenUri(new Uri(url), profileArg: profileArg);
}
else
{
OpenUri(new Uri(url));
}
}
public void OpenUrl(string url, bool? inPrivate = null)

public void OpenUrl(string url, bool? inPrivate = null, string additionalArgs = "")
{
OpenUri(new Uri(url), inPrivate);
OpenUri(new Uri(url), inPrivate, additionalArgs);
}

public void OpenUrl(Uri url, bool? inPrivate = null)
public void OpenUrl(Uri url, bool? inPrivate = null, string additionalArgs = "")
{
OpenUri(url, inPrivate);
OpenUri(url, inPrivate, additionalArgs);
}

public void OpenAppUri(string appUri)
Expand Down

AltStyle によって変換されたページ (->オリジナル) /