Merge branch 'dev' into administrator_mode

This commit is contained in:
Jack Ye 2025-08-16 04:44:21 +01:00 committed by GitHub
commit e85c569cfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 139 additions and 36 deletions

View file

@ -10,7 +10,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:

View file

@ -20,7 +20,7 @@ jobs:
NUGET_CERT_REVOCATION_MODE: offline
BUILD_NUMBER: ${{ github.run_number }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set Flow.Launcher.csproj version
id: update
uses: vers-one/dotnet-project-version-updater@v1.7

View file

@ -11,7 +11,7 @@ jobs:
update-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:

View file

@ -39,6 +39,48 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Target Name="RemoveUnnecessaryRuntimesAfterBuild" AfterTargets="Build">
<RemoveDir Directories="$(OutputPath)runtimes\browser-wasm;
$(OutputPath)runtimes\linux-arm;
$(OutputPath)runtimes\linux-arm64;
$(OutputPath)runtimes\linux-armel;
$(OutputPath)runtimes\linux-mips64;
$(OutputPath)runtimes\linux-musl-arm;
$(OutputPath)runtimes\linux-musl-arm64;
$(OutputPath)runtimes\linux-musl-x64;
$(OutputPath)runtimes\linux-musl-s390x;
$(OutputPath)runtimes\linux-ppc64le;
$(OutputPath)runtimes\linux-s390x;
$(OutputPath)runtimes\linux-x64;
$(OutputPath)runtimes\linux-x86;
$(OutputPath)runtimes\maccatalyst-arm64;
$(OutputPath)runtimes\maccatalyst-x64;
$(OutputPath)runtimes\osx;
$(OutputPath)runtimes\osx-arm64;
$(OutputPath)runtimes\osx-x64"/>
</Target>
<Target Name="RemoveUnnecessaryRuntimesAfterPublish" AfterTargets="Publish">
<RemoveDir Directories="$(PublishDir)runtimes\browser-wasm;
$(PublishDir)runtimes\linux-arm;
$(PublishDir)runtimes\linux-arm64;
$(PublishDir)runtimes\linux-armel;
$(PublishDir)runtimes\linux-mips64;
$(PublishDir)runtimes\linux-musl-arm;
$(PublishDir)runtimes\linux-musl-arm64;
$(PublishDir)runtimes\linux-musl-x64;
$(PublishDir)runtimes\linux-musl-s390x;
$(PublishDir)runtimes\linux-ppc64le;
$(PublishDir)runtimes\linux-s390x;
$(PublishDir)runtimes\linux-x64;
$(PublishDir)runtimes\linux-x86;
$(PublishDir)runtimes\maccatalyst-arm64;
$(PublishDir)runtimes\maccatalyst-x64;
$(PublishDir)runtimes\osx;
$(PublishDir)runtimes\osx-arm64;
$(PublishDir)runtimes\osx-x64"/>
</Target>
<ItemGroup>
<ApplicationDefinition Remove="App.xaml" />
</ItemGroup>

View file

@ -534,10 +534,8 @@
MinHeight="380"
MaxHeight="{Binding ElementName=ResultListBox, Path=ActualHeight}"
Padding="0 0 10 10"
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
DataContext="{Binding PreviewSelectedItem, Mode=OneWay}"
Visibility="{Binding ShowCustomizedPreview}">
<ContentControl Content="{Binding Result.PreviewPanel.Value}" />
<ContentControl Content="{Binding CustomizedPreviewControl}" />
</Border>
</Grid>
</Grid>

View file

@ -9,6 +9,7 @@ using System.Threading.Channels;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using CommunityToolkit.Mvvm.DependencyInjection;
@ -883,6 +884,12 @@ namespace Flow.Launcher.ViewModel
}
}
public Visibility ShowCustomizedPreview
=> InternalPreviewVisible && PreviewSelectedItem?.Result.PreviewPanel != null ? Visibility.Visible : Visibility.Collapsed;
public UserControl CustomizedPreviewControl
=> ShowCustomizedPreview == Visibility.Visible ? PreviewSelectedItem?.Result.PreviewPanel.Value : null;
public Visibility ProgressBarVisibility { get; set; }
public Visibility MainWindowVisibility { get; set; }

View file

@ -37,12 +37,17 @@ namespace Flow.Launcher.ViewModel
OnPropertyChanged(nameof(Image));
}
private bool _imageLoaded = false;
public ImageSource Image
{
get
{
if (_image == ImageLoader.MissingImage)
if (!_imageLoaded)
{
_imageLoaded = true;
_ = LoadIconAsync();
}
return _image;
}

View file

@ -66,8 +66,6 @@ namespace Flow.Launcher.ViewModel
public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed;
public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;
public Visibility ShowIcon
{
get

View file

@ -36,6 +36,26 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex
_faviconCacheDir = Path.Combine(
context.CurrentPluginMetadata.PluginCacheDirectoryPath,
"FaviconCache");
try
{
if (Directory.Exists(_faviconCacheDir))
{
var files = Directory.GetFiles(_faviconCacheDir);
foreach (var file in files)
{
var extension = Path.GetExtension(file);
if (extension is ".db-shm" or ".db-wal" or ".sqlite-shm" or ".sqlite-wal")
{
File.Delete(file);
}
}
}
}
catch (Exception e)
{
Context.API.LogException(ClassName, "Failed to clean up orphaned cache files.", e);
}
LoadBookmarksIfEnabled();
}

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

@ -191,7 +191,19 @@ namespace Flow.Launcher.Plugin.WebSearch
[JsonIgnore]
public SearchSource SelectedSearchSource { get; set; }
public bool EnableSuggestion { get; set; }
private bool enableSuggestion;
public bool EnableSuggestion
{
get => enableSuggestion;
set
{
if (enableSuggestion != value)
{
enableSuggestion = value;
OnPropertyChanged(nameof(EnableSuggestion));
}
}
}
[JsonIgnore]
public SuggestionSource[] Suggestions { get; set; } = {
@ -221,9 +233,5 @@ namespace Flow.Launcher.Plugin.WebSearch
}
}
}
public string BrowserPath { get; set; }
public bool OpenInNewBrowser { get; set; } = true;
}
}

View file

@ -11,10 +11,6 @@
mc:Ignorable="d">
<UserControl.Resources>
<Style x:Key="BrowserPathBoxStyle" TargetType="TextBox">
<Setter Property="Height" Value="28" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<DataTemplate x:Key="HeaderTemplateArrowUp">
<DockPanel>
<TextBlock HorizontalAlignment="Center" Text="{Binding}" />
@ -96,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>
@ -138,7 +148,7 @@
Margin="{StaticResource SettingPanelItemLeftMargin}"
VerticalAlignment="Center"
FontSize="11"
IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}"
IsEnabled="{Binding Settings.EnableSuggestion}"
ItemsSource="{Binding Settings.Suggestions}"
SelectedItem="{Binding Settings.SelectedSuggestion}" />
<CheckBox
@ -149,7 +159,6 @@
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
IsChecked="{Binding Settings.EnableSuggestion}" />
</StackPanel>
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSearchSuggestion is not working -->
</DockPanel>
</Grid>
</UserControl>

View file

@ -94,7 +94,8 @@ namespace Flow.Launcher.Plugin.WebSearch
var columnBinding = headerClicked.Column.DisplayMemberBinding as Binding;
var sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string;
if(sortBy != null) {
if (sortBy != null)
{
Sort(sortBy, direction);
if (direction == ListSortDirection.Ascending)

View file

@ -141,6 +141,6 @@
"Enabled": true
}
],
"EnableWebSearchSuggestion": false,
"WebSearchSuggestionSource": "Google"
"EnableSuggestion": false,
"Suggestion": "Google"
}