diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs index e0a21725135..003e72a5d86 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs @@ -113,7 +113,7 @@ public void UpdateSettings(IReadOnlyDictionary settings) // If can parse the default value to bool, use it, otherwise use false : value is string stringValue && bool.TryParse(stringValue, out var boolValueFromString) && boolValueFromString; - checkBox.Dispatcher.Invoke(() =>checkBox.IsChecked = isChecked); + checkBox.Dispatcher.Invoke(() => checkBox.IsChecked = isChecked); break; } } @@ -154,8 +154,7 @@ public bool NeedCreateSettingPanel() public Control CreateSettingPanel() { - // No need to check if NeedCreateSettingPanel is true because CreateSettingPanel will only be called if it's true - // if (!NeedCreateSettingPanel()) return null; + if (!NeedCreateSettingPanel()) return null!; // Create main grid with two columns (Column 1: Auto, Column 2: *) var mainPanel = new Grid { Margin = SettingPanelMargin, VerticalAlignment = VerticalAlignment.Center }; diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 0f878151e72..1cccc38d938 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,8 @@ public string SettingWindowFont { _settingWindowFont = value; OnPropertyChanged(); + Application.Current.Resources["SettingWindowFont"] = new FontFamily(value); + Application.Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(value); } } } diff --git a/Flow.Launcher/ActionKeywords.xaml b/Flow.Launcher/ActionKeywords.xaml index 740b0d40254..887b13126cf 100644 --- a/Flow.Launcher/ActionKeywords.xaml +++ b/Flow.Launcher/ActionKeywords.xaml @@ -53,11 +53,11 @@ - - + + - + - + @@ -112,20 +112,20 @@ Grid.Row="1" Background="{DynamicResource PopupButtonAreaBGColor}" BorderBrush="{DynamicResource PopupButtonAreaBorderColor}" - BorderThickness="0,1,0,0"> + BorderThickness="0 1 0 0"> (); - _viewModel = new SettingsPanePluginsViewModel(settings); + _viewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; InitializeComponent(); } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml index 768abbf978a..f429a6e29cf 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml @@ -2,11 +2,11 @@ x:Class="Flow.Launcher.SettingPages.Views.SettingsPaneProxy" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:ui="http://schemas.modernwpf.com/2019" - xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls" xmlns:viewModels="clr-namespace:Flow.Launcher.SettingPages.ViewModels" Title="Proxy" d:DataContext="{d:DesignInstance viewModels:SettingsPaneProxyViewModel}" @@ -18,8 +18,8 @@ @@ -71,9 +71,9 @@ diff --git a/Flow.Launcher/WelcomeWindow.xaml.cs b/Flow.Launcher/WelcomeWindow.xaml.cs index 637f9448d9a..ef07067650c 100644 --- a/Flow.Launcher/WelcomeWindow.xaml.cs +++ b/Flow.Launcher/WelcomeWindow.xaml.cs @@ -2,16 +2,17 @@ using System.Windows; using System.Windows.Input; using System.Windows.Controls; -using Flow.Launcher.Resources.Pages; -using ModernWpf.Media.Animation; using CommunityToolkit.Mvvm.DependencyInjection; -using Flow.Launcher.ViewModel; using Flow.Launcher.Infrastructure.UserSettings; +using Flow.Launcher.Resources.Pages; +using Flow.Launcher.ViewModel; +using ModernWpf.Media.Animation; namespace Flow.Launcher { public partial class WelcomeWindow : Window { + private readonly Settings _settings; private readonly WelcomeViewModel _viewModel; private readonly NavigationTransitionInfo _forwardTransitionInfo = new SlideNavigationTransitionInfo() @@ -25,6 +26,7 @@ public partial class WelcomeWindow : Window public WelcomeWindow() { + _settings = Ioc.Default.GetRequiredService(); _viewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; InitializeComponent(); @@ -76,10 +78,7 @@ private static Type PageTypeSelector(int pageNumber) private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */ { - if (Keyboard.FocusedElement is not TextBox textBox) - { - return; - } + if (Keyboard.FocusedElement is not TextBox textBox) return; var tRequest = new TraversalRequest(FocusNavigationDirection.Next); textBox.MoveFocus(tRequest); } @@ -96,8 +95,10 @@ private void ContentFrame_Loaded(object sender, RoutedEventArgs e) private void Window_Closed(object sender, EventArgs e) { + // If app is exiting, settings save is not needed because main window closing event will handle this + if (App.Exiting) return; // Save settings when window is closed - Ioc.Default.GetRequiredService().Save(); + _settings.Save(); } } } diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml index f5017ced5d8..80b004ff993 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml @@ -60,17 +60,17 @@ - - + + - + @@ -86,23 +86,23 @@ Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" - Margin="5,0,0,20"> + Margin="5 0 0 20"> @@ -180,18 +180,18 @@ Grid.Row="1" Background="{DynamicResource PopupButtonAreaBGColor}" BorderBrush="{DynamicResource PopupButtonAreaBorderColor}" - BorderThickness="0,1,0,0"> + BorderThickness="0 1 0 0"> - - + + - + - + + BorderThickness="0 1 0 0"> - - + + - + @@ -104,16 +104,16 @@ HorizontalAlignment="Stretch" Click="BrowseButton_Click" Content="{DynamicResource flowlauncher_plugin_program_browse}" - Visibility="{Binding IsCustomSource, Converter={StaticResource BooleanToVisibilityConverter}}" - DockPanel.Dock="Right" /> + DockPanel.Dock="Right" + Visibility="{Binding IsCustomSource, Converter={StaticResource BooleanToVisibilityConverter}}" /> + VerticalAlignment="Center" + IsReadOnly="{Binding IsNotCustomSource}" + Text="{Binding Location, Mode=TwoWay}" /> + Margin="10 0" + VerticalAlignment="Center" + IsChecked="{Binding Enabled, Mode=TwoWay}" /> + BorderThickness="0 1 0 0"> - + - + @@ -151,82 +151,82 @@ TextWrapping="Wrap" /> - + - + appref-ms exe lnk + BorderThickness="1 0 0 0"> @@ -237,27 +237,27 @@ Grid.Row="1" Background="{DynamicResource PopupButtonAreaBGColor}" BorderBrush="{DynamicResource PopupButtonAreaBorderColor}" - BorderThickness="0,1,0,0"> + BorderThickness="0 1 0 0">