Merge pull request #800 from onesounds/GlobalBrowserSetting

Global browser setting / Private mode option
This commit is contained in:
Jeremy Wu 2021-12-09 20:01:06 +11:00 committed by GitHub
commit 037e0f83bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 701 additions and 336 deletions

View file

@ -0,0 +1,33 @@
using Flow.Launcher.Plugin;
using System.Text.Json.Serialization;
namespace Flow.Launcher.Infrastructure.UserSettings
{
public class CustomBrowserViewModel : BaseModel
{
public string Name { get; set; }
public string Path { get; set; }
public string PrivateArg { get; set; }
public bool EnablePrivate { get; set; }
public bool OpenInTab { get; set; } = true;
[JsonIgnore]
public bool OpenInNewWindow => !OpenInTab;
public bool Editable { get; set; } = true;
public CustomBrowserViewModel Copy()
{
return new CustomBrowserViewModel
{
Name = Name,
Path = Path,
OpenInTab = OpenInTab,
PrivateArg = PrivateArg,
EnablePrivate = EnablePrivate,
Editable = Editable
};
}
}
}

View file

@ -39,6 +39,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public string ResultFontWeight { get; set; }
public string ResultFontStretch { get; set; }
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public bool UseSound { get; set; } = true;
public bool FirstLaunch { get; set; } = true;
public int CustomExplorerIndex { get; set; } = 0;
@ -84,8 +86,52 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
};
public bool UseAnimation { get; set; } = true;
public bool UseSound { get; set; } = true;
public int CustomBrowserIndex { get; set; } = 0;
[JsonIgnore]
public CustomBrowserViewModel CustomBrowser
{
get => CustomBrowserList[CustomBrowserIndex];
set => CustomBrowserList[CustomBrowserIndex] = value;
}
public List<CustomBrowserViewModel> CustomBrowserList { get; set; } = new()
{
new()
{
Name = "Default",
Path = "*",
PrivateArg = "",
EnablePrivate = false,
Editable = false
},
new()
{
Name = "Google Chrome",
Path = "chrome",
PrivateArg = "-incognito",
EnablePrivate = false,
Editable = false
},
new()
{
Name = "Mozilla Firefox",
Path = "firefox",
PrivateArg = "-private",
EnablePrivate = false,
Editable = false
}
,
new()
{
Name = "MS Edge",
Path = "msedge",
PrivateArg = "-inPrivate",
EnablePrivate = false,
Editable = false
}
};
/// <summary>
/// when false Alphabet static service will always return empty results

View file

@ -226,5 +226,10 @@ namespace Flow.Launcher.Plugin
/// <param name="DirectoryPath">Directory Path to open</param>
/// <param name="FileName">Extra FileName Info</param>
public void OpenDirectory(string DirectoryPath, string FileName = null);
/// <summary>
/// Opens the url. The browser and mode used is based on what's configured in Flow's default browser settings.
/// </summary>
public void OpenUrl(string url, bool? inPrivate = null);
}
}

View file

@ -35,18 +35,21 @@ namespace Flow.Launcher.Plugin.SharedCommands
/// 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 NewBrowserWindow(this string url, string browserPath = "")
public static void OpenInBrowserWindow(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "")
{
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;
var browserExecutableName = browserPath?
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();
.Split(new[]
{
Path.DirectorySeparatorChar
}, StringSplitOptions.None)
.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" ? url : "--new-window " + url;
var browserArguements = (browserExecutableName == "iexplore.exe" ? "" : "--new-window ") + (inPrivate ? $"{privateArg} " : "") + url;
var psi = new ProcessStartInfo
{
@ -61,24 +64,36 @@ namespace Flow.Launcher.Plugin.SharedCommands
}
catch (System.ComponentModel.Win32Exception)
{
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
Process.Start(new ProcessStartInfo
{
FileName = url, UseShellExecute = true
});
}
}
[Obsolete("This is provided for backwards compatibility after 1.9.0 release, e.g. GitHub plugin. Use the new method instead")]
public static void NewBrowserWindow(this string url, string browserPath = "")
{
OpenInBrowserWindow(url, browserPath);
}
/// <summary>
/// Opens search as a tab in the default browser chosen in Windows settings.
/// </summary>
public static void NewTabInBrowser(this string url, string browserPath = "")
public static void OpenInBrowserTab(this string url, string browserPath = "", bool inPrivate = false, string privateArg = "")
{
browserPath = string.IsNullOrEmpty(browserPath) ? GetDefaultBrowserPath() : browserPath;
var psi = new ProcessStartInfo() { UseShellExecute = true };
var psi = new ProcessStartInfo()
{
UseShellExecute = true
};
try
{
if (!string.IsNullOrEmpty(browserPath))
{
psi.FileName = browserPath;
psi.Arguments = url;
psi.Arguments = (inPrivate ? $"{privateArg} " : "") + url;
}
else
{
@ -90,8 +105,17 @@ namespace Flow.Launcher.Plugin.SharedCommands
// This error may be thrown if browser path is incorrect
catch (System.ComponentModel.Win32Exception)
{
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
Process.Start(new ProcessStartInfo
{
FileName = url, UseShellExecute = true
});
}
}
[Obsolete("This is provided for backwards compatibility after 1.9.0 release, e.g. GitHub plugin. Use the new method instead")]
public static void NewTabInBrowser(this string url, string browserPath = "")
{
OpenInBrowserTab(url, browserPath);
}
}
}
}

View file

@ -38,6 +38,8 @@
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
<system:String x:Key="defaultFileManager">Default File Manager</system:String>
<system:String x:Key="defaultFileManagerToolTip">Select the file manager to use when opening the folder.</system:String>
<system:String x:Key="defaultBrowser">Default Web Browser</system:String>
<system:String x:Key="defaultBrowserToolTip">Setting for New Tab, New Window, Private Mode.</system:String>
<system:String x:Key="pythonDirectory">Python Directory</system:String>
<system:String x:Key="autoUpdates">Auto Update</system:String>
<system:String x:Key="selectPythonDirectory">Select</system:String>
@ -164,6 +166,16 @@
<system:String x:Key="fileManager_directory_arg">Arg For Folder</system:String>
<system:String x:Key="fileManager_file_arg">Arg For File</system:String>
<!-- DefaultBrowser Setting Dialog -->
<system:String x:Key="defaultBrowserTitle">Default Web Browser</system:String>
<system:String x:Key="defaultBrowser_tips">The default setting follows the OS default browser setting. If specified separately, flow uses that browser.</system:String>
<system:String x:Key="defaultBrowser_name">Browser</system:String>
<system:String x:Key="defaultBrowser_profile_name">Browser Name</system:String>
<system:String x:Key="defaultBrowser_path">Browser Path</system:String>
<system:String x:Key="defaultBrowser_newtab">New Window</system:String>
<system:String x:Key="defaultBrowser_newWindow">New Tab</system:String>
<system:String x:Key="defaultBrowser_parameter">Priviate Mode</system:String>
<!-- Priority Setting Dialog -->
<system:String x:Key="changePriorityWindow">Change Priority</system:String>
<system:String x:Key="priority_tips">Greater the number, the higher the result will be ranked. Try setting it as 5. If you want the results to be lower than any other plugin's, provide a negative number</system:String>

View file

@ -114,7 +114,7 @@ namespace Flow.Launcher
var startInfo = ShellCommand.SetProcessStartInfo(filename, arguments: args, createNoWindow: true);
ShellCommand.Execute(startInfo);
}
public void CopyToClipboard(string text)
{
Clipboard.SetDataObject(text);
@ -196,7 +196,7 @@ namespace Flow.Launcher
public void OpenDirectory(string DirectoryPath, string FileName = null)
{
using Process explorer = new Process();
using var explorer = new Process();
var explorerInfo = _settingsVM.Settings.CustomExplorer;
explorer.StartInfo = new ProcessStartInfo
{
@ -209,6 +209,23 @@ namespace Flow.Launcher
explorer.Start();
}
public void OpenUrl(string url, bool? inPrivate = null)
{
var browserInfo = _settingsVM.Settings.CustomBrowser;
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
if (browserInfo.OpenInTab)
{
url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
}
else
{
url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
}
}
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
private readonly List<Func<int, int, SpecialKeyState, bool>> _globalKeyboardHandlers = new();

View file

@ -0,0 +1,264 @@
<Window
x:Class="Flow.Launcher.SelectBrowserWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Title="{DynamicResource defaultBrowserTitle}"
Width="550"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="4"
Click="btnCancel_Click"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,12,26,0">
<StackPanel Margin="0,0,0,12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
FontFamily="Segoe UI"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource defaultBrowserTitle}"
TextAlignment="Left" />
</StackPanel>
<StackPanel>
<TextBlock
FontSize="14"
Text="{DynamicResource defaultBrowser_tips}"
TextAlignment="Left"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<StackPanel Margin="14,28,0,0" Orientation="Horizontal">
<TextBlock
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_name}" />
<ComboBox
Name="comboBox"
Width="200"
Height="35"
Margin="14,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding CustomBrowsers}"
SelectedIndex="{Binding SelectedCustomBrowserIndex}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button
Margin="10,0,0,0"
Click="btnAdd_Click"
Content="{DynamicResource add}" />
<Button
Margin="10,0,0,0"
Click="btnDelete_Click"
Content="{DynamicResource delete}"
IsEnabled="{Binding CustomBrowser.Editable}" />
</StackPanel>
<Rectangle
Height="1"
Margin="0,20,0,12"
Fill="{DynamicResource SeparatorForeground}" />
<StackPanel
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
DataContext="{Binding CustomBrowser}"
Orientation="Horizontal">
<Grid Width="480">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="14,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_profile_name}" />
<TextBox
x:Name="ProfileTextBox"
Grid.Row="0"
Grid.Column="1"
Width="Auto"
Margin="10,5,15,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
IsEnabled="{Binding Editable}"
Text="{Binding Name}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="14,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_path}" />
<StackPanel
Grid.Row="1"
Grid.Column="1"
Orientation="Horizontal">
<TextBox
x:Name="PathTextBox"
Width="220"
Margin="10,10,5,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
IsEnabled="{Binding Editable}"
Text="{Binding Path}" />
<Button
Name="btnBrowseFile"
Width="80"
Margin="0,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="btnBrowseFile_Click"
Content="{DynamicResource selectPythonDirectory}"
DockPanel.Dock="Right">
<Button.Style>
<Style BasedOn="{StaticResource DefaultButtonStyle}" TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=PathTextBox, UpdateSourceTrigger=PropertyChanged, Path=IsEnabled}" Value="False">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
<StackPanel
Grid.Row="2"
Grid.Column="1"
Margin="14,10,14,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<RadioButton IsChecked="{Binding OpenInTab}">New Tab</RadioButton>
<RadioButton IsChecked="{Binding OpenInNewWindow, Mode=OneTime}">New Window</RadioButton>
</StackPanel>
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="14,10,0,20"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_parameter}" />
<StackPanel
Grid.Row="3"
Grid.Column="1"
Margin="0,10,0,15"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBox
x:Name="fileArgTextBox"
Width="180"
Margin="10,0,0,0"
Text="{Binding PrivateArg}" />
<CheckBox
Margin="12,0,0,0"
VerticalAlignment="Center"
IsChecked="{Binding EnablePrivate}">
<CheckBox.Style>
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="{x:Type CheckBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text.Length, ElementName=fileArgTextBox, UpdateSourceTrigger=PropertyChanged}" Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="145"
Margin="0,0,5,0"
Click="btnCancel_Click"
Content="{DynamicResource cancel}" />
<Button
x:Name="btnDone"
Width="145"
Margin="5,0,0,0"
Click="btnDone_Click"
Content="{DynamicResource done}"
ForceCursor="True"
Style="{DynamicResource AccentButtonStyle}" />
</StackPanel>
</Border>
</Grid>
</Window>

View file

@ -0,0 +1,88 @@
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Flow.Launcher
{
public partial class SelectBrowserWindow : Window, INotifyPropertyChanged
{
private int selectedCustomBrowserIndex;
public event PropertyChangedEventHandler PropertyChanged;
public Settings Settings { get; }
public int SelectedCustomBrowserIndex
{
get => selectedCustomBrowserIndex; set
{
selectedCustomBrowserIndex = value;
PropertyChanged?.Invoke(this, new(nameof(CustomBrowser)));
}
}
public ObservableCollection<CustomBrowserViewModel> CustomBrowsers { get; set; }
public CustomBrowserViewModel CustomBrowser => CustomBrowsers[SelectedCustomBrowserIndex];
public SelectBrowserWindow(Settings settings)
{
Settings = settings;
CustomBrowsers = new ObservableCollection<CustomBrowserViewModel>(Settings.CustomBrowserList.Select(x => x.Copy()));
SelectedCustomBrowserIndex = Settings.CustomBrowserIndex;
InitializeComponent();
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void btnDone_Click(object sender, RoutedEventArgs e)
{
Settings.CustomBrowserList = CustomBrowsers.ToList();
Settings.CustomBrowserIndex = SelectedCustomBrowserIndex;
Close();
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
CustomBrowsers.Add(new()
{
Name = "New Profile"
});
SelectedCustomBrowserIndex = CustomBrowsers.Count - 1;
}
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
CustomBrowsers.RemoveAt(SelectedCustomBrowserIndex--);
}
private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
path.Text = dlg.FileName;
path.Focus();
((Button)sender).Focus();
}
}
}
}

View file

@ -818,6 +818,30 @@
</ItemsControl>
</Border>
<Border Margin="0,4,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource defaultBrowser}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource defaultBrowserToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button
Width="160"
MaxWidth="250"
Margin="10,0,18,0"
Click="OnSelectDefaultBrowserClick"
Content="{Binding Settings.CustomBrowser.Name}" />
</StackPanel>
<TextBlock Style="{StaticResource Glyph}">
&#xf6fa;
</TextBlock>
</ItemsControl>
</Border>
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">

View file

@ -120,6 +120,12 @@ namespace Flow.Launcher
fileManagerChangeWindow.ShowDialog();
}
private void OnSelectDefaultBrowserClick(object sender, RoutedEventArgs e)
{
var browserWindow = new SelectBrowserWindow(settings);
browserWindow.ShowDialog();
}
#endregion
#region Hotkey
@ -260,7 +266,7 @@ namespace Flow.Launcher
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
{
e.Uri.AbsoluteUri.NewTabInBrowser();
API.OpenUrl(e.Uri.AbsoluteUri);
e.Handled = true;
}

View file

@ -191,7 +191,7 @@ namespace Flow.Launcher.ViewModel
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(); });
OpenResultCommand = new RelayCommand(index =>

View file

@ -1,12 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--Plugin Info-->
<system:String x:Key="flowlauncher_plugin_browserbookmark_plugin_name">Browser Bookmarks</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_plugin_description">Search your browser bookmarks</system:String>
<!-- Plugin Info -->
<system:String x:Key="flowlauncher_plugin_browserbookmark_plugin_name">Browser Bookmarks</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_plugin_description">Search your browser bookmarks</system:String>
<!--Settings-->
<!-- Settings -->
<system:String x:Key="BookmarkDataSetting">Bookmmark Data</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_settings_openBookmarks">Open bookmarks in:</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_settings_newWindow">New window</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_settings_newTab">New tab</system:String>
@ -16,7 +18,7 @@
<system:String x:Key="flowlauncher_plugin_browserbookmark_copyurl_subtitle">Copy the bookmark's url to clipboard</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_loadBrowserFrom">Load Browser From:</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserName">Browser Name</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory">DataDirectoryPath</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory">Data Directory Path</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_addBrowserBookmark">Add</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_removeBrowserBookmark">Delete</system:String>
</ResourceDictionary>

View file

@ -48,14 +48,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
Score = BookmarkLoader.MatchProgram(c, param).Score,
Action = _ =>
{
if (_settings.OpenInNewBrowserWindow)
{
c.Url.NewBrowserWindow(_settings.BrowserPath);
}
else
{
c.Url.NewTabInBrowser(_settings.BrowserPath);
}
context.API.OpenUrl(c.Url);
return true;
},
@ -73,15 +66,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
Score = 5,
Action = _ =>
{
if (_settings.OpenInNewBrowserWindow)
{
c.Url.NewBrowserWindow(_settings.BrowserPath);
}
else
{
c.Url.NewTabInBrowser(_settings.BrowserPath);
}
context.API.OpenUrl(c.Url);
return true;
},
ContextData = new BookmarkAttributes { Url = c.Url }

View file

@ -1,38 +1,130 @@
<Window x:Class="Flow.Launcher.Plugin.BrowserBookmark.Views.CustomBrowserSettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.BrowserBookmark.Models"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="CustomBrowserSetting" Height="350" Width="600"
KeyDown="WindowKeyDown"
>
<Window
x:Class="Flow.Launcher.Plugin.BrowserBookmark.Views.CustomBrowserSettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.BrowserBookmark.Models"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource BookmarkDataSetting}"
Width="500"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
KeyDown="WindowKeyDown"
SizeToContent="Height"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Window.DataContext>
<local:CustomBrowser/>
<local:CustomBrowser />
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="60"/>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Browser Name" FontSize="15"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="80 0 0 0"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Browser Data Directory Path" FontSize="15"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="80 0 0 0"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Name}"
HorizontalAlignment="Left" VerticalAlignment="Center" Width="100" Height="30" Margin="50 0 0 0"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding DataDirectoryPath}"
HorizontalAlignment="Left" VerticalAlignment="Center" Width="200" Height="30" Margin="50 0 0 0"/>
<StackPanel HorizontalAlignment="Center" Grid.Row="2" Orientation="Horizontal" Grid.Column="1" Height="70">
<Button Name="btnConfirm" Content="Confirm" Margin="15" Click="ConfirmCancelEditCustomBrowser"/>
<Button Content="Cancel" Margin="15" Click="ConfirmCancelEditCustomBrowser"/>
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="4"
Click="ConfirmCancelEditCustomBrowser"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,0,26,0">
<StackPanel Margin="0,0,0,12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
FontFamily="Segoe UI"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource BookmarkDataSetting}"
TextAlignment="Left" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock
Width="140"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}" />
<TextBox
Width="120"
Height="30"
Margin="50,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Name}" />
</StackPanel>
<StackPanel Margin="0,14,0,24" Orientation="Horizontal">
<TextBlock
Width="140"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}" />
<TextBox
Width="250"
Height="30"
Margin="50,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding DataDirectoryPath}" />
</StackPanel>
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="145"
Height="30"
Margin="0,0,5,0"
Click="ConfirmCancelEditCustomBrowser"
Content="{DynamicResource cancel}" />
<Button
Name="btnConfirm"
Width="145"
Height="30"
Margin="5,0,0,0"
Click="ConfirmCancelEditCustomBrowser"
Style="{StaticResource AccentButtonStyle}">
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
</Button>
</StackPanel>
</Border>
</Grid>
</Window>

View file

@ -10,71 +10,12 @@
mc:Ignorable="d">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="80" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel>
<Grid Grid.Row="0" Margin="30,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160" />
<ColumnDefinition Width="140" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Label
Grid.Column="0"
Margin="10,5,0,0"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_settings_openBookmarks}"
FontSize="15" />
<RadioButton
Name="NewWindowBrowser"
Grid.Column="1"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_settings_newWindow}"
IsChecked="{Binding OpenInNewBrowserWindow}" />
<RadioButton
Name="NewTabInBrowser"
Grid.Column="2"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_settings_newTab}"
IsChecked="{Binding OpenInNewTab, Mode=OneTime}" />
</Grid>
</StackPanel>
<StackPanel
Grid.Row="1"
Height="60"
Margin="30,20,0,0"
VerticalAlignment="Top"
Orientation="Horizontal">
<Label
Height="28"
Margin="10"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_settings_setBrowserFromPath}" />
<TextBox
x:Name="BrowserPathBox"
Width="240"
Height="34"
Margin="10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Settings.BrowserPath}"
TextWrapping="NoWrap" />
<Button
x:Name="ViewButton"
Width="100"
Height="30"
Margin="10"
HorizontalAlignment="Left"
Click="OnChooseClick"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_settings_choose}"
FontSize="14" />
</StackPanel>
<StackPanel
Grid.Row="2"
Margin="30,20,0,0"
Orientation="Vertical">
<StackPanel Margin="0,0,0,0" Orientation="Vertical">
<TextBlock Margin="10" Text="{DynamicResource flowlauncher_plugin_browserbookmark_loadBrowserFrom}" />
<ListView
Name="CustomBrowsers"
Grid.Row="2"
Height="auto"
Margin="10"
BorderBrush="DarkGray"
@ -92,12 +33,12 @@
</ListView>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="80"
Width="110"
Margin="10"
Click="NewCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}" />
<Button
Width="80"
Width="110"
Margin="10"
Click="DeleteCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}" />

View file

@ -1,19 +1,16 @@
using Microsoft.Win32;
using System.Windows;
using System.Windows.Controls;
using Flow.Launcher.Plugin.BrowserBookmark.Models;
using System.Windows.Input;
using System.ComponentModel;
namespace Flow.Launcher.Plugin.BrowserBookmark.Views
{
/// <summary>
/// Interaction logic for BrowserBookmark.xaml
/// </summary>
public partial class SettingsControl : INotifyPropertyChanged
{
public Settings Settings { get; }
public CustomBrowser SelectedCustomBrowser { get; set; }
public bool OpenInNewBrowserWindow
{
get => Settings.OpenInNewBrowserWindow;
@ -23,10 +20,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Views
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OpenInNewBrowserWindow)));
}
}
public bool OpenInNewTab
{
get => !OpenInNewBrowserWindow;
}
public SettingsControl(Settings settings)
{
@ -36,18 +29,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Views
public event PropertyChangedEventHandler PropertyChanged;
private void OnChooseClick(object sender, RoutedEventArgs e)
{
var fileBrowserDialog = new OpenFileDialog();
fileBrowserDialog.Filter = "Application(*.exe)|*.exe|All files|*.*";
fileBrowserDialog.CheckFileExists = true;
fileBrowserDialog.CheckPathExists = true;
if (fileBrowserDialog.ShowDialog() == true)
{
Settings.BrowserPath = fileBrowserDialog.FileName;
}
}
private void NewCustomBrowser(object sender, RoutedEventArgs e)
{
var newBrowser = new CustomBrowser();

View file

@ -4,7 +4,7 @@
"Name": "Browser Bookmarks",
"Description": "Search your browser bookmarks",
"Author": "qianlifeng, Ioannis G.",
"Version": "1.5.3",
"Version": "1.6.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.BrowserBookmark.dll",

View file

@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
IcoPath = selectedResult.IcoPath,
Action = _ =>
{
SharedCommands.SearchWeb.NewTabInBrowser(pluginManifestInfo.Website);
Context.API.OpenUrl(pluginManifestInfo.Website);
return true;
}
},
@ -40,7 +40,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
IcoPath = "Images\\sourcecode.png",
Action = _ =>
{
SharedCommands.SearchWeb.NewTabInBrowser(pluginManifestInfo.UrlSourceCode);
Context.API.OpenUrl(pluginManifestInfo.UrlSourceCode);
return true;
}
},
@ -56,7 +56,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
? pluginManifestInfo.UrlSourceCode.Replace("/tree/master", "/issues/new/choose")
: pluginManifestInfo.UrlSourceCode;
SharedCommands.SearchWeb.NewTabInBrowser(link);
Context.API.OpenUrl(link);
return true;
}
},
@ -67,7 +67,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
IcoPath = "Images\\manifestsite.png",
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;
}
}

View file

@ -6,7 +6,7 @@
"Name": "Plugins Manager",
"Description": "Management of installing, uninstalling or updating Flow Launcher plugins",
"Author": "Jeremy Wu",
"Version": "1.10.0",
"Version": "1.11.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",

View file

@ -315,7 +315,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\app.png",
Action = c =>
{
SearchWeb.NewTabInBrowser(Constant.Documentation);
context.API.OpenUrl(Constant.Documentation);
return true;
}
},

View file

@ -4,7 +4,7 @@
"Name": "System Commands",
"Description": "Provide System related commands. e.g. shutdown,lock, setting etc.",
"Author": "qianlifeng",
"Version": "1.5.1",
"Version": "1.6.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Sys.dll",

View file

@ -68,14 +68,7 @@ namespace Flow.Launcher.Plugin.Url
}
try
{
if (_settings.OpenInNewBrowserWindow)
{
raw.NewBrowserWindow(_settings.BrowserPath);
}
else
{
raw.NewTabInBrowser(_settings.BrowserPath);
}
context.API.OpenUrl(raw);
return true;
}

View file

@ -1,29 +1,17 @@
<UserControl x:Class="Flow.Launcher.Plugin.Url.SettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="500">
<UserControl
x:Class="Flow.Launcher.Plugin.Url.SettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="0"
d:DesignHeight="300"
d:DesignWidth="500"
mc:Ignorable="d">
<Grid Margin="40,40,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Label Content="{DynamicResource flowlauncher_plugin_url_open_search_in}" Margin="0 10 15 0" />
<RadioButton x:Name="NewWindowBrowser"
Content="{DynamicResource flowlauncher_plugin_new_window}" Click="OnNewBrowserWindowClick" />
<RadioButton x:Name="NewTabInBrowser"
Content="{DynamicResource flowlauncher_plugin_new_tab}" Click="OnNewTabClick" />
</StackPanel>
<StackPanel VerticalAlignment="Top" Grid.Row="1" Height="106" Margin="0 20 0 0">
<Label Content="{DynamicResource flowlauncher_plugin_url_plugin_set_tip}" Height="28" Margin="0,0,155,0"
HorizontalAlignment="Left" Width="290" />
<TextBox x:Name="browserPathBox" HorizontalAlignment="Left" Height="34" TextWrapping="NoWrap"
VerticalAlignment="Top" Width="311" RenderTransformOrigin="0.502,-1.668" TextChanged="OnBrowserPathTextChanged" />
<Button x:Name="viewButton" HorizontalAlignment="Left" Margin="340,-33,-1,0" Width="100"
Height="32" Click="OnChooseClick" FontSize="14"
Content="{DynamicResource flowlauncher_plugin_url_plugin_choose}" />
</StackPanel>
</Grid>
</UserControl>

View file

@ -1,25 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
namespace Flow.Launcher.Plugin.Url
{
/// <summary>
/// SettingsControl.xaml 的交互逻辑
/// </summary>
public partial class SettingsControl : UserControl
{
private Settings _settings;
@ -30,37 +15,7 @@ namespace Flow.Launcher.Plugin.Url
InitializeComponent();
_settings = settings;
_flowlauncherAPI = flowlauncherAPI;
browserPathBox.Text = _settings.BrowserPath;
NewWindowBrowser.IsChecked = _settings.OpenInNewBrowserWindow;
NewTabInBrowser.IsChecked = !_settings.OpenInNewBrowserWindow;
}
private void OnChooseClick(object sender, RoutedEventArgs e)
{
var fileBrowserDialog = new OpenFileDialog();
fileBrowserDialog.Filter = _flowlauncherAPI.GetTranslation("flowlauncher_plugin_url_plugin_filter"); ;
fileBrowserDialog.CheckFileExists = true;
fileBrowserDialog.CheckPathExists = true;
if (fileBrowserDialog.ShowDialog() == true)
{
browserPathBox.Text = fileBrowserDialog.FileName;
_settings.BrowserPath = fileBrowserDialog.FileName;
}
}
private void OnNewBrowserWindowClick(object sender, RoutedEventArgs e)
{
_settings.OpenInNewBrowserWindow = true;
}
private void OnNewTabClick(object sender, RoutedEventArgs e)
{
_settings.OpenInNewBrowserWindow = false;
}
private void OnBrowserPathTextChanged(object sender, TextChangedEventArgs e)
{
_settings.BrowserPath = browserPathBox.Text;
}
}
}

View file

@ -4,7 +4,7 @@
"Name": "URL",
"Description": "Open the typed URL from Flow Launcher",
"Author": "qianlifeng",
"Version": "1.1.7",
"Version": "1.2.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Url.dll",

View file

@ -74,14 +74,7 @@ namespace Flow.Launcher.Plugin.WebSearch
Score = score,
Action = c =>
{
if (_settings.OpenInNewBrowser)
{
searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewBrowserWindow(_settings.BrowserPath);
}
else
{
searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)).NewTabInBrowser(_settings.BrowserPath);
}
_context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)));
return true;
}
@ -143,14 +136,7 @@ namespace Flow.Launcher.Plugin.WebSearch
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
Action = c =>
{
if (_settings.OpenInNewBrowser)
{
searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewBrowserWindow(_settings.BrowserPath);
}
else
{
searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)).NewTabInBrowser(_settings.BrowserPath);
}
_context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)));
return true;
}
@ -170,7 +156,7 @@ namespace Flow.Launcher.Plugin.WebSearch
_settings = _context.API.LoadSettingJsonStorage<Settings>();
_viewModel = new SettingsViewModel(_settings);
var pluginDirectory = _context.CurrentPluginMetadata.PluginDirectory;
var bundledImagesDirectory = Path.Combine(pluginDirectory, Images);

View file

@ -37,59 +37,13 @@
</UserControl.Resources>
<Grid Margin="14,14,14,0">
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="40" />
<RowDefinition />
<RowDefinition Height="56" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
Margin="14,0,0,0"
HorizontalAlignment="Left"
Orientation="Horizontal">
<Label Margin="0,15,20,0" Content="{DynamicResource flowlauncher_plugin_websearch_open_search_in}" />
<RadioButton
Name="NewWindowBrowser"
Margin="0,0,20,0"
Click="OnNewBrowserWindowClick"
Content="{DynamicResource flowlauncher_plugin_websearch_new_window}"
GroupName="OpenSearchBehaviour" />
<RadioButton
Name="NewTabInBrowser"
Click="OnNewTabClick"
Content="{DynamicResource flowlauncher_plugin_websearch_new_tab}"
GroupName="OpenSearchBehaviour" />
</StackPanel>
<StackPanel
Grid.Row="1"
Margin="14,3,0,0"
HorizontalAlignment="Left"
Orientation="Horizontal">
<Label
Margin="0,0,10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="{DynamicResource flowlaucnher_plugin_websearch_set_browser_path}" />
<TextBox
x:Name="browserPathBox"
Width="250"
Margin="0,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource BrowserPathBoxStyle}"
TextChanged="OnBrowserPathTextChanged" />
<Button
x:Name="viewButton"
Width="80"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Click="OnChooseClick"
Content="{DynamicResource flowlauncher_plugin_websearch_choose}"
FontSize="13" />
</StackPanel>
<ListView
x:Name="SearchSourcesListView"
Grid.Row="2"
Grid.Row="0"
Margin="0,18,0,0"
BorderBrush="DarkGray"
BorderThickness="1"
@ -146,7 +100,7 @@
</ListView.View>
</ListView>
<StackPanel
Grid.Row="3"
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
@ -166,7 +120,7 @@
Content="{DynamicResource flowlauncher_plugin_websearch_add}" />
</StackPanel>
<Border
Grid.Row="4"
Grid.Row="2"
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
BorderBrush="#cecece"

View file

@ -21,9 +21,6 @@ namespace Flow.Launcher.Plugin.WebSearch
_context = context;
_settings = viewModel.Settings;
DataContext = viewModel;
browserPathBox.Text = _settings.BrowserPath;
NewWindowBrowser.IsChecked = _settings.OpenInNewBrowser;
NewTabInBrowser.IsChecked = !_settings.OpenInNewBrowser;
}
private void OnAddSearchSearchClick(object sender, RoutedEventArgs e)
@ -63,34 +60,6 @@ namespace Flow.Launcher.Plugin.WebSearch
}
}
private void OnNewBrowserWindowClick(object sender, RoutedEventArgs e)
{
_settings.OpenInNewBrowser = true;
}
private void OnNewTabClick(object sender, RoutedEventArgs e)
{
_settings.OpenInNewBrowser = false;
}
private void OnChooseClick(object sender, RoutedEventArgs e)
{
var fileBrowserDialog = new OpenFileDialog();
fileBrowserDialog.Filter = "Application(*.exe)|*.exe|All files|*.*";
fileBrowserDialog.CheckFileExists = true;
fileBrowserDialog.CheckPathExists = true;
if (fileBrowserDialog.ShowDialog() == true)
{
browserPathBox.Text = fileBrowserDialog.FileName;
_settings.BrowserPath = fileBrowserDialog.FileName;
}
}
private void OnBrowserPathTextChanged(object sender, TextChangedEventArgs e)
{
_settings.BrowserPath = browserPathBox.Text;
}
GridViewColumnHeader _lastHeaderClicked = null;
ListSortDirection _lastDirection = ListSortDirection.Ascending;

View file

@ -26,7 +26,7 @@
"Name": "Web Searches",
"Description": "Provide the web search ability",
"Author": "qianlifeng",
"Version": "1.4.1",
"Version": "1.5.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",