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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class CustomBrowserViewModel : BaseModel
public string DisplayName => Name == "Default" ? Localize.defaultBrowser_default() : Name;
public string Path { get; set; }
public string PrivateArg { get; set; }
public string ExtraArgs { get; set; }
public bool EnablePrivate { get; set; }
public bool OpenInTab { get; set; } = true;
[JsonIgnore]
Expand All @@ -24,6 +25,7 @@ public CustomBrowserViewModel Copy()
Path = Path,
OpenInTab = OpenInTab,
PrivateArg = PrivateArg,
ExtraArgs = ExtraArgs,
EnablePrivate = EnablePrivate,
Editable = Editable
};
Expand Down
13 changes: 9 additions & 4 deletions Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/// 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 extraArgs = "")
{
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;

Expand All @@ -52,12 +52,15 @@
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 browserArguements = (browserExecutableName == "iexplore.exe" ? "" : "--new-window ")

Check warning on line 55 in Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`iexplore` is not a recognized word (unrecognized-spelling)

Check warning on line 55 in Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Arguements` is not a recognized word (unrecognized-spelling)

Check warning on line 55 in Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

View workflow job for this annotation

GitHub Actions / Report (PR)

`iexplore` is not a recognized word (unrecognized-spelling)

Check warning on line 55 in Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

View workflow job for this annotation

GitHub Actions / Report (PR)

`Arguements` is not a recognized word (unrecognized-spelling)
+ (inPrivate ? $"{privateArg} " : "")
+ (string.IsNullOrWhiteSpace(extraArgs) ? "" : $"{extraArgs} ")
+ url;

var psi = new ProcessStartInfo
{
FileName = browser,
Arguments = browserArguements,

Check warning on line 63 in Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Arguements` is not a recognized word (unrecognized-spelling)
UseShellExecute = true
};

Expand Down Expand Up @@ -86,7 +89,7 @@
/// <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 = "")
public static void OpenInBrowserTab(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "", string extraArgs = "")
{
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;

Expand All @@ -99,7 +102,9 @@
if (!string.IsNullOrEmpty(browserPath))
{
psi.FileName = browserPath;
psi.Arguments = (inPrivate ? $"{privateArg} " : "") + url;
psi.Arguments = (inPrivate ? $"{privateArg} " : "")
+ (string.IsNullOrWhiteSpace(extraArgs) ? "" : $"{extraArgs} ")
+ url;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<system:String x:Key="restartToDisablePortableMode">Flow Launcher needs to restart to finish disabling portable mode, after the restart your portable data profile will be deleted and roaming data profile kept</system:String>
<system:String x:Key="restartToEnablePortableMode">Flow Launcher needs to restart to finish enabling portable mode, after the restart your roaming data profile will be deleted and portable data profile kept</system:String>
<system:String x:Key="moveToDifferentLocation">Flow Launcher has detected you enabled portable mode, would you like to move it to a different location?</system:String>
<system:String x:Key="shortcutsUninstallerCreated">Flow Launcher has detected you disabled portable mode, the relevant shortcuts and uninstaller entry have been created</system:String>

Check warning on line 25 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`uninstaller` is not a recognized word (unrecognized-spelling)

Check warning on line 25 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Report (PR)

`uninstaller` is not a recognized word (unrecognized-spelling)
<system:String x:Key="userDataDuplicated">Flow Launcher detected your user data exists both in {0} and {1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred.</system:String>

<!-- Plugin Loader -->
Expand Down Expand Up @@ -81,8 +81,8 @@
<system:String x:Key="useLogonTaskForStartupTooltip">After uninstallation, you need to manually remove this task (Flow.Launcher Startup) via Task Scheduler</system:String>
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
<system:String x:Key="showTaskbarWhenOpened">Show taskbar when Flow Launcher is opened</system:String>

Check warning on line 84 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word (unrecognized-spelling)

Check warning on line 84 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Report (PR)

`taskbar` is not a recognized word (unrecognized-spelling)
<system:String x:Key="showTaskbarWhenOpenedToolTip">Temporarily show the taskbar when Flow Launcher is opened, useful for auto-hidden taskbars.</system:String>

Check warning on line 85 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbars` is not a recognized word (unrecognized-spelling)

Check warning on line 85 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Report (PR)

`taskbars` is not a recognized word (unrecognized-spelling)
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
<system:String x:Key="SearchWindowPosition">Search Window Location</system:String>
<system:String x:Key="SearchWindowScreenRememberLastLaunchLocation">Remember Last Position</system:String>
Expand Down Expand Up @@ -518,6 +518,7 @@
<system:String x:Key="defaultBrowser_newWindow">New Window</system:String>
<system:String x:Key="defaultBrowser_newTab">New Tab</system:String>
<system:String x:Key="defaultBrowser_parameter">Private Mode</system:String>
<system:String x:Key="defaultBrowser_extraArgs">Extra Args</system:String>
<system:String x:Key="defaultBrowser_default">Default</system:String>
<system:String x:Key="defaultBrowser_new_profile">New Profile</system:String>

Expand Down
6 changes: 3 additions & 3 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.ViewModel;
using iNKORE.UI.WPF.Modern;

Check warning on line 34 in Flow.Launcher/PublicAPIInstance.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word (unrecognized-spelling)

Check warning on line 34 in Flow.Launcher/PublicAPIInstance.cs

View workflow job for this annotation

GitHub Actions / Report (PR)

`NKORE` is not a recognized word (unrecognized-spelling)
using JetBrains.Annotations;
using Squirrel;
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
Expand Down Expand Up @@ -454,17 +454,17 @@
{
if (browserInfo.OpenInTab)
{
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, browserInfo.ExtraArgs);
}
else
{
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg, browserInfo.ExtraArgs);
}
}
catch (Exception e)
{
var tabOrWindow = browserInfo.OpenInTab ? "tab" : "window";
LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}", e);
LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}, {browserInfo.ExtraArgs}", e);
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
ShowMsgError(
Localize.errorTitle(),
Localize.browserOpenError()
Expand Down
20 changes: 18 additions & 2 deletions Flow.Launcher/SelectBrowserWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Title="{DynamicResource defaultBrowserTitle}"
Width="550"
d:DataContext="{d:DesignInstance vm:SelectBrowserViewModel}"
Background="{DynamicResource PopuBGColor}"

Check warning on line 13 in Flow.Launcher/SelectBrowserWindow.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`Popu` is not a recognized word (unrecognized-spelling)
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"
Expand Down Expand Up @@ -126,6 +126,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Expand Down Expand Up @@ -198,15 +199,15 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="14 10 0 20"
Margin="14 10 0 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_parameter}" />
<StackPanel
Grid.Row="3"
Grid.Column="1"
Margin="0 10 0 15"
Margin="0 10 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Orientation="Horizontal">
Expand All @@ -230,6 +231,21 @@
</CheckBox.Style>
</CheckBox>
</StackPanel>
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="14 10 0 20"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_extraArgs}" />
<TextBox
Grid.Row="4"
Grid.Column="1"
Margin="10 10 0 15"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Text="{Binding ExtraArgs}" />
</Grid>
</StackPanel>
</StackPanel>
Expand Down
Loading