From 028acd2bfc459156ea08dd91af9e6ccff860dd13 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Apr 2025 15:47:48 +0800 Subject: [PATCH 01/22] Move setting window font to dynamic resources --- .../UserSettings/Settings.cs | 2 ++ Flow.Launcher/App.xaml.cs | 12 ++++++------ Flow.Launcher/Resources/SettingWindowStyle.xaml | 11 +++++++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 0f878151e72..ca015fd70ca 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -2,6 +2,7 @@ using System.Collections.ObjectModel; using System.Text.Json.Serialization; using System.Windows; +using System.Windows.Media; using CommunityToolkit.Mvvm.DependencyInjection; using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Infrastructure.Logger; @@ -113,6 +114,7 @@ public string SettingWindowFont { _settingWindowFont = value; OnPropertyChanged(); + Application.Current.Resources["SettingWindowFont"] = new FontFamily(value); } } } diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 87698a54571..4e77f5a5cb2 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; +using System.Windows.Media; using CommunityToolkit.Mvvm.DependencyInjection; using Flow.Launcher.Core; using Flow.Launcher.Core.Configuration; @@ -149,7 +150,7 @@ await API.StopwatchLogInfoAsync(ClassName, "Startup cost", async () => Ioc.Default.GetRequiredService().PreStartCleanUpAfterPortabilityUpdate(); API.LogInfo(ClassName, "Begin Flow Launcher startup ----------------------------------------------------"); - API.LogInfo(ClassName, "Runtime info:{ErrorReporting.RuntimeInfo()}"); + API.LogInfo(ClassName, $"Runtime info:{ErrorReporting.RuntimeInfo()}"); RegisterAppDomainExceptions(); RegisterDispatcherUnhandledException(); @@ -169,19 +170,18 @@ await API.StopwatchLogInfoAsync(ClassName, "Startup cost", async () => await PluginManager.InitializePluginsAsync(); // Change language after all plugins are initialized because we need to update plugin title based on their api - // TODO: Clean InternationalizationManager.Instance and InternationalizationManager.Instance.GetTranslation in future await Ioc.Default.GetRequiredService().InitializeLanguageAsync(); - await imageLoadertask; - _mainWindow = new MainWindow(); + // Update dynamic resources base on settings + Current.Resources["SettingWindowFont"] = new FontFamily(_settings.SettingWindowFont); - API.LogInfo(ClassName, "Dependencies Info:{ErrorReporting.DependenciesInfo()}"); + _mainWindow = new MainWindow(); Current.MainWindow = _mainWindow; Current.MainWindow.Title = Constant.FlowLauncher; - // main windows needs initialized before theme change because of blur settings + // Main windows needs initialized before theme change because of blur settings Ioc.Default.GetRequiredService().ChangeTheme(); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); diff --git a/Flow.Launcher/Resources/SettingWindowStyle.xaml b/Flow.Launcher/Resources/SettingWindowStyle.xaml index fc9246aa33d..0a238b376ef 100644 --- a/Flow.Launcher/Resources/SettingWindowStyle.xaml +++ b/Flow.Launcher/Resources/SettingWindowStyle.xaml @@ -8,6 +8,9 @@ + + Segoe UI + F1 M512,512z M0,0z M448,256C448,150,362,64,256,64L256,448C362,448,448,362,448,256z M0,256A256,256,0,1,1,512,256A256,256,0,1,1,0,256z diff --git a/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs b/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs index 9b19ffd8626..fcdbf8f45ea 100644 --- a/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs +++ b/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs @@ -42,11 +42,9 @@ public DisplayType Type private static void keyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var control = d as UserControl; - if (null == control) return; // This should not be possible + if (d is not UserControl) return; // This should not be possible - var newValue = e.NewValue as string; - if (null == newValue) return; + if (e.NewValue is not string newValue) return; if (d is not HotkeyDisplay hotkeyDisplay) return; From 3208df3523622c318546d1f1af80544708ea333a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Apr 2025 17:06:21 +0800 Subject: [PATCH 08/22] Improve plugin store page font --- .../SettingsPanePluginStoreViewModel.cs | 1 - .../Views/SettingsPanePluginStore.xaml | 68 +++++++++++-------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs index fd2c8e09fa1..68c69f8411b 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Threading.Tasks; using CommunityToolkit.Mvvm.Input; -using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin; using Flow.Launcher.ViewModel; diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml index 89d25377b77..4a5f821a34f 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml @@ -37,9 +37,9 @@ + Padding="5 18 0 0"> + Margin="5 24 0 0"> @@ -97,13 +99,14 @@ From 361901b2a38cd3da41f5995820c8d659afb586ad Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Apr 2025 17:12:54 +0800 Subject: [PATCH 09/22] Improve action keywords font --- Flow.Launcher/ActionKeywords.xaml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Flow.Launcher/ActionKeywords.xaml b/Flow.Launcher/ActionKeywords.xaml index 740b0d40254..87f803d9841 100644 --- a/Flow.Launcher/ActionKeywords.xaml +++ b/Flow.Launcher/ActionKeywords.xaml @@ -5,6 +5,7 @@ Title="{DynamicResource actionKeywordsTitle}" Width="450" Background="{DynamicResource PopuBGColor}" + FontFamily="{DynamicResource SettingWindowFont}" Foreground="{DynamicResource PopupTextColor}" Icon="Images\app.png" Loaded="ActionKeyword_OnLoaded" @@ -53,11 +54,11 @@ - - + + - + - + @@ -112,21 +113,23 @@ Grid.Row="1" Background="{DynamicResource PopupButtonAreaBGColor}" BorderBrush="{DynamicResource PopupButtonAreaBorderColor}" - BorderThickness="0,1,0,0"> + BorderThickness="0 1 0 0"> From b29d31025a91c26885069fdcff957e4941c9a77a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Apr 2025 17:13:12 +0800 Subject: [PATCH 10/22] Improve custom query hotkey font --- Flow.Launcher/CustomQueryHotkeySetting.xaml | 12 ++++++++---- Flow.Launcher/CustomQueryHotkeySetting.xaml.cs | 10 +++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml b/Flow.Launcher/CustomQueryHotkeySetting.xaml index d3c31c6da5c..647f015f098 100644 --- a/Flow.Launcher/CustomQueryHotkeySetting.xaml +++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml @@ -8,7 +8,7 @@ Width="530" Background="{DynamicResource PopuBGColor}" DataContext="{Binding RelativeSource={RelativeSource Self}}" - FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}" + FontFamily="{DynamicResource SettingWindowFont}" Foreground="{DynamicResource PopupTextColor}" Icon="Images\app.png" MouseDown="window_MouseDown" @@ -120,7 +120,8 @@ Grid.Column="1" Margin="10" HorizontalAlignment="Stretch" - VerticalAlignment="Center" /> + VerticalAlignment="Center" + FontFamily="{DynamicResource SettingWindowFont}" /> diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs index cc07caaa21e..77febde9d5b 100644 --- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs +++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs @@ -10,14 +10,14 @@ namespace Flow.Launcher { public partial class CustomQueryHotkeySetting : Window { - public Settings Settings { get; } + private readonly Settings _settings; private bool update; private CustomPluginHotkey updateCustomHotkey; public CustomQueryHotkeySetting(Settings settings) { - Settings = settings; + _settings = settings; InitializeComponent(); } @@ -30,13 +30,13 @@ private void btnAdd_OnClick(object sender, RoutedEventArgs e) { if (!update) { - Settings.CustomPluginHotkeys ??= new ObservableCollection(); + _settings.CustomPluginHotkeys ??= new ObservableCollection(); var pluginHotkey = new CustomPluginHotkey { Hotkey = HotkeyControl.CurrentHotkey.ToString(), ActionKeyword = tbAction.Text }; - Settings.CustomPluginHotkeys.Add(pluginHotkey); + _settings.CustomPluginHotkeys.Add(pluginHotkey); HotKeyMapper.SetCustomQueryHotkey(pluginHotkey); } @@ -55,7 +55,7 @@ private void btnAdd_OnClick(object sender, RoutedEventArgs e) public void UpdateItem(CustomPluginHotkey item) { - updateCustomHotkey = Settings.CustomPluginHotkeys.FirstOrDefault(o => + updateCustomHotkey = _settings.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey); if (updateCustomHotkey == null) { From c0e090266a3ee5c2fdd159640c4dbfb9eb413c96 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Apr 2025 17:13:24 +0800 Subject: [PATCH 11/22] Improve custom shortcut setting font --- Flow.Launcher/CustomShortcutSetting.xaml | 11 ++++++++--- Flow.Launcher/CustomShortcutSetting.xaml.cs | 4 ---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/CustomShortcutSetting.xaml b/Flow.Launcher/CustomShortcutSetting.xaml index cbdcecea6a9..0d68f64de08 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml +++ b/Flow.Launcher/CustomShortcutSetting.xaml @@ -7,7 +7,7 @@ Width="530" Background="{DynamicResource PopuBGColor}" DataContext="{Binding RelativeSource={RelativeSource Self}}" - FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}" + FontFamily="{DynamicResource SettingWindowFont}" Foreground="{DynamicResource PopupTextColor}" Icon="Images\app.png" ResizeMode="NoResize" @@ -109,6 +109,7 @@ Width="180" Margin="10" HorizontalAlignment="Left" + FontFamily="{DynamicResource SettingWindowFont}" Text="{Binding Key}" /> + DockPanel.Dock="Right" + FontFamily="{DynamicResource SettingWindowFont}" /> @@ -153,12 +156,14 @@ MinWidth="140" Margin="10 0 5 0" Click="BtnCancel_OnClick" - Content="{DynamicResource cancel}" /> + Content="{DynamicResource cancel}" + FontFamily="{DynamicResource SettingWindowFont}" /> diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index fcee0c96196..e180f657024 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -1,15 +1,11 @@ using System.Windows; using System.Windows.Input; -using CommunityToolkit.Mvvm.DependencyInjection; -using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.SettingPages.ViewModels; namespace Flow.Launcher { public partial class CustomShortcutSetting : Window { - public Settings Settings { get; } = Ioc.Default.GetRequiredService(); - private readonly SettingsPaneHotkeyViewModel _hotkeyVm; public string Key { get; set; } = string.Empty; public string Value { get; set; } = string.Empty; From acff23f4838d3f47774c88cdfe65867a2829f667 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 23 Apr 2025 17:33:21 +0800 Subject: [PATCH 12/22] Improve hotkey display & hotkey control & hotkey dialog font --- Flow.Launcher/HotkeyControl.xaml | 27 ++++----- Flow.Launcher/HotkeyControlDialog.xaml | 57 ++++++++++--------- .../Resources/Controls/HotkeyDisplay.xaml | 5 +- 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml b/Flow.Launcher/HotkeyControl.xaml index 02c625da558..632d354e7a1 100644 --- a/Flow.Launcher/HotkeyControl.xaml +++ b/Flow.Launcher/HotkeyControl.xaml @@ -7,15 +7,15 @@ mc:Ignorable="d">