Merge pull request #3891 from zoltanvi/feature/web_search_private_mode

Add private mode option to WebSearch plugin items
This commit is contained in:
Jack Ye 2025-08-14 02:17:15 +01:00 committed by GitHub
commit f244812be1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 13 deletions

View file

@ -13,6 +13,7 @@
<system:String x:Key="flowlauncher_plugin_websearch_edit">Edit</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_add">Add</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_enabled_label">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_private_mode_label">Private Mode</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_true">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_false">Disabled</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_confirm">Confirm</system:String>

View file

@ -71,7 +71,7 @@ namespace Flow.Launcher.Plugin.WebSearch
Score = score,
Action = c =>
{
_context.API.OpenWebUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)));
_context.API.OpenWebUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)), searchSource.IsPrivateMode);
return true;
},
@ -135,7 +135,7 @@ namespace Flow.Launcher.Plugin.WebSearch
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
Action = c =>
{
_context.API.OpenWebUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)));
_context.API.OpenWebUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)), searchSource.IsPrivateMode);
return true;
},

View file

@ -7,6 +7,7 @@ namespace Flow.Launcher.Plugin.WebSearch
public class SearchSource : BaseModel
{
public string Title { get; set; }
public string ActionKeyword { get; set; }
[NotNull]
@ -19,21 +20,17 @@ namespace Flow.Launcher.Plugin.WebSearch
/// Custom icons are placed in the user data directory
/// </summary>
[JsonIgnore]
public string IconPath
{
get
{
if (CustomIcon)
return Path.Combine(Main.CustomImagesDirectory, Icon);
return Path.Combine(Main.DefaultImagesDirectory, Icon);
}
}
public string IconPath => CustomIcon
? Path.Combine(Main.CustomImagesDirectory, Icon)
: Path.Combine(Main.DefaultImagesDirectory, Icon);
public string Url { get; set; }
[JsonIgnore]
public bool Status => Enabled;
public bool IsPrivateMode { get; set; }
public bool Enabled { get; set; }
public SearchSource DeepCopy()
@ -45,8 +42,10 @@ namespace Flow.Launcher.Plugin.WebSearch
Url = Url,
Icon = Icon,
CustomIcon = CustomIcon,
IsPrivateMode = IsPrivateMode,
Enabled = Enabled
};
return webSearch;
}
}

View file

@ -101,6 +101,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
@ -181,12 +182,26 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_websearch_enabled_label}" />
Text="{DynamicResource flowlauncher_plugin_websearch_private_mode_label}" />
<CheckBox
Grid.Row="4"
Grid.Column="1"
Margin="10 10 10 15"
VerticalAlignment="Center"
IsChecked="{Binding SearchSource.IsPrivateMode}" />
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="10 0 10 10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_websearch_enabled_label}" />
<CheckBox
Grid.Row="5"
Grid.Column="1"
Margin="10 0 10 10"
VerticalAlignment="Center"
IsChecked="{Binding SearchSource.Enabled}" />
</Grid>
</StackPanel>

View file

@ -92,6 +92,20 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn
Width="120"
Header="{DynamicResource flowlauncher_plugin_websearch_private_mode_label}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsPrivateMode}"
IsEnabled="False"
/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>