mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
use shared commands
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
|
using Wox.Plugin.SharedCommands;
|
||||||
|
|
||||||
namespace Wox.Plugin.Url
|
namespace Wox.Plugin.Url
|
||||||
{
|
{
|
||||||
@@ -80,15 +79,8 @@ namespace Wox.Plugin.Url
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var browserExecutableName = _settings.BrowserPath?.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
raw.NewBrowserWindow(_settings.BrowserPath);
|
||||||
|
|
||||||
var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : _settings.BrowserPath;
|
|
||||||
|
|
||||||
// Internet Explorer will open url in new browser window, and does not take the --new-window parameter
|
|
||||||
var browserArguements = browserExecutableName == "iexplore.exe" ? raw : "--new-window " + raw;
|
|
||||||
|
|
||||||
Process.Start(browser, browserArguements);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Wox.Plugin.WebSearch.Commands
|
namespace Wox.Plugin.SharedCommands
|
||||||
{
|
{
|
||||||
internal static class SearchWeb
|
public static class SearchWeb
|
||||||
{
|
{
|
||||||
/// <summary> Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
/// <summary> 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>
|
||||||
internal static void NewBrowserWindow(this string url, string browserPath)
|
public static void NewBrowserWindow(this string url, string browserPath)
|
||||||
{
|
{
|
||||||
var browserExecutableName = browserPath?
|
var browserExecutableName = browserPath?
|
||||||
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
|
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
|
||||||
|
|||||||
Reference in New Issue
Block a user