mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use Global Browser Setting around flow
This commit is contained in:
parent
47562eabf3
commit
d8eef69e21
8 changed files with 19 additions and 49 deletions
|
|
@ -35,7 +35,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
||||||
/// Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
/// Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
||||||
/// Leave browser path blank to use Chrome.
|
/// Leave browser path blank to use Chrome.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void NewBrowserWindow(this string url, string browserPath = "", bool inPrivate = false)
|
public static void NewBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "")
|
||||||
{
|
{
|
||||||
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;
|
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
||||||
var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath;
|
var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath;
|
||||||
|
|
||||||
// Internet Explorer will open url in new browser window, and does not take the --new-window parameter
|
// Internet Explorer will open url in new browser window, and does not take the --new-window parameter
|
||||||
var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url;
|
var browserArguements = browserExecutableName == "iexplore.exe" ? url : "--new-window " + url + (inPrivate ? "" : privateArg);
|
||||||
|
|
||||||
var psi = new ProcessStartInfo
|
var psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
|
|
@ -68,7 +68,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens search as a tab in the default browser chosen in Windows settings.
|
/// Opens search as a tab in the default browser chosen in Windows settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void NewTabInBrowser(this string url, string browserPath = "", bool inPrivate = false)
|
public static void NewTabInBrowser(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "")
|
||||||
{
|
{
|
||||||
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;
|
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
||||||
if (!string.IsNullOrEmpty(browserPath))
|
if (!string.IsNullOrEmpty(browserPath))
|
||||||
{
|
{
|
||||||
psi.FileName = browserPath;
|
psi.FileName = browserPath;
|
||||||
psi.Arguments = url + (inPrivate ? "" : "-inprivate");
|
psi.Arguments = url + (inPrivate ? "" : privateArg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -216,23 +216,14 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
|
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
|
||||||
|
|
||||||
if (browserInfo.Path == "Default")
|
if (browserInfo.OpenInTab)
|
||||||
{
|
{
|
||||||
if (browserInfo.OpenInTab)
|
SearchWeb.NewTabInBrowser(url, path, browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||||
SearchWeb.NewTabInBrowser(url);
|
}else
|
||||||
else
|
{
|
||||||
SearchWeb.NewBrowserWindow(url);
|
SearchWeb.NewBrowserWindow(url, path, browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var browserStartInfo = new ProcessStartInfo()
|
|
||||||
{
|
|
||||||
FileName = browserInfo.Path
|
|
||||||
};
|
|
||||||
browserStartInfo.ArgumentList.Add(url);
|
|
||||||
|
|
||||||
if(browserInfo.EnablePrivate)
|
|
||||||
browserStartInfo.ArgumentList.Add(browserInfo.PrivateArg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||||
{
|
{
|
||||||
e.Uri.AbsoluteUri.NewTabInBrowser();
|
API.OpenUrl(e.Uri.AbsoluteUri);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
StartHelpCommand = new RelayCommand(_ =>
|
StartHelpCommand = new RelayCommand(_ =>
|
||||||
{
|
{
|
||||||
SearchWeb.NewTabInBrowser("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/");
|
PluginManager.API.OpenUrl("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/");
|
||||||
});
|
});
|
||||||
OpenSettingCommand = new RelayCommand(_ => { App.API.OpenSettingDialog(); });
|
OpenSettingCommand = new RelayCommand(_ => { App.API.OpenSettingDialog(); });
|
||||||
OpenResultCommand = new RelayCommand(index =>
|
OpenResultCommand = new RelayCommand(index =>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
IcoPath = selectedResult.IcoPath,
|
IcoPath = selectedResult.IcoPath,
|
||||||
Action = _ =>
|
Action = _ =>
|
||||||
{
|
{
|
||||||
SharedCommands.SearchWeb.NewTabInBrowser(pluginManifestInfo.Website);
|
Context.API.OpenUrl(pluginManifestInfo.Website);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
IcoPath = "Images\\sourcecode.png",
|
IcoPath = "Images\\sourcecode.png",
|
||||||
Action = _ =>
|
Action = _ =>
|
||||||
{
|
{
|
||||||
SharedCommands.SearchWeb.NewTabInBrowser(pluginManifestInfo.UrlSourceCode);
|
Context.API.OpenUrl(pluginManifestInfo.UrlSourceCode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
? pluginManifestInfo.UrlSourceCode.Replace("/tree/master", "/issues/new/choose")
|
? pluginManifestInfo.UrlSourceCode.Replace("/tree/master", "/issues/new/choose")
|
||||||
: pluginManifestInfo.UrlSourceCode;
|
: pluginManifestInfo.UrlSourceCode;
|
||||||
|
|
||||||
SharedCommands.SearchWeb.NewTabInBrowser(link);
|
Context.API.OpenUrl(link);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -67,7 +67,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
IcoPath = "Images\\manifestsite.png",
|
IcoPath = "Images\\manifestsite.png",
|
||||||
Action = _ =>
|
Action = _ =>
|
||||||
{
|
{
|
||||||
SharedCommands.SearchWeb.NewTabInBrowser("https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest");
|
Context.API.OpenUrl("https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ namespace Flow.Launcher.Plugin.Sys
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
SearchWeb.NewTabInBrowser(Constant.Documentation);
|
context.API.OpenUrl(Constant.Documentation);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,7 @@ namespace Flow.Launcher.Plugin.Url
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_settings.OpenInNewBrowserWindow)
|
context.API.OpenUrl(raw);
|
||||||
{
|
|
||||||
raw.NewBrowserWindow(_settings.BrowserPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
raw.NewTabInBrowser(_settings.BrowserPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
Score = score,
|
Score = score,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
if (_settings.OpenInNewBrowser)
|
_context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)));
|
||||||
{
|
|
||||||
searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(_settings.BrowserPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewTabInBrowser(_settings.BrowserPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -143,14 +136,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
|
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
if (_settings.OpenInNewBrowser)
|
searchSource.Url.Replace("{q}", Uri.EscapeDataString(o));
|
||||||
{
|
|
||||||
searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow(_settings.BrowserPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewTabInBrowser(_settings.BrowserPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue