diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 274f88dc674..f7e7661f8ff 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -17,8 +17,10 @@ public class Settings : BaseModel public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public string ColorScheme { get; set; } = "System"; + public string ThemeMode { get; set; } = "Modern"; public bool ShowOpenResultHotkey { get; set; } = true; public double WindowSize { get; set; } = 580; + public WindowStyle WindowStyle { get; set; } = WindowStyle.None; public string PreviewHotkey { get; set; } = $"F1"; public string Language @@ -43,6 +45,13 @@ public string Theme } } public bool UseDropShadowEffect { get; set; } = false; + + /* Appearance Settings. It should be separated from the setting later.*/ + public double WindowHeightSize { get; set; } = 40; + public double ItemHeightSize { get; set; } = 58; + public double QueryBoxFontSize { get; set; } = 18; + public double ResultItemFontSize { get; set; } = 16; + public double ResultSubItemFontSize { get; set; } = 13; public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; public string QueryBoxFontStyle { get; set; } public string QueryBoxFontWeight { get; set; } @@ -51,6 +60,7 @@ public string Theme public string ResultFontStyle { get; set; } 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; @@ -278,7 +288,13 @@ public enum ColorSchemes Light, Dark } - + + public enum ThemeModes + { + Modern, + Legacy + } + public enum SearchWindowScreens { RememberLastLaunchLocation, diff --git a/Flow.Launcher/App.xaml b/Flow.Launcher/App.xaml index b8e2a1cfe48..91e433363d7 100644 --- a/Flow.Launcher/App.xaml +++ b/Flow.Launcher/App.xaml @@ -3,11 +3,17 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="http://schemas.modernwpf.com/2019" + xmlns:uix="http://schemas.lepo.co/wpfui/2022/xaml" ShutdownMode="OnMainWindowClose" Startup="OnStartupAsync"> + + + + + diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 53c1bafc738..44abbd2156b 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -97,6 +97,7 @@ + diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 4bc79ccb398..ca76f5e8f89 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -144,6 +144,7 @@ Terminate unwanted processes Query Box Font Result Item Font + Item Subtitle Font Window Mode Opacity Theme {0} not exists, fallback to default theme @@ -168,6 +169,10 @@ Custom Clock Date + Theme Mode (Beta) + Select the window rendering method. Modern mode is available in Windows 10 and later versions. There are differences in some features. + Modern + Legacy Hotkey diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index e2c74d367c8..a7d8e715239 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -1,4 +1,4 @@ - - + + + + @@ -42,8 +49,8 @@ - - + + @@ -188,317 +195,322 @@ Modifiers="Ctrl" /> + Command="{Binding CopyAlternativeCommand}" + Modifiers="Ctrl+Shift" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + + + + + + + + + + + + - - + + - \ No newline at end of file + \ No newline at end of file diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 50370404661..4091737fb65 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -27,6 +27,17 @@ using static Flow.Launcher.ViewModel.SettingWindowViewModel; using DataObject = System.Windows.DataObject; using System.Windows.Media; +using System.Runtime.InteropServices; +using System.Windows.Interop; +using System.Threading; +using Wpf.Ui.Appearance; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using Window = System.Windows.Window; +using Windows.UI.Composition; +using Wpf.Ui.Controls; +using MenuItem = System.Windows.Controls.MenuItem; +using FontIcon = ModernWpf.Controls.FontIcon; +using System.Diagnostics; namespace Flow.Launcher { @@ -45,6 +56,10 @@ public partial class MainWindow #endregion + // Remove OS minimizing/maximizing animation + [DllImport("dwmapi.dll")] + private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize); + private const int DWMWA_TRANSITIONS_FORCEDISABLED = 3; public MainWindow(Settings settings, MainViewModel mainVM) { DataContext = mainVM; @@ -57,8 +72,19 @@ public MainWindow(Settings settings, MainViewModel mainVM) animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); DataObject.AddPastingHandler(QueryTextBox, OnPaste); + this.Loaded += (obj, args) => + { + var handle = new WindowInteropHelper(this).Handle; + var win = HwndSource.FromHwnd(handle); + win.AddHook(new HwndSourceHook(WndProc)); + }; } + DispatcherTimer timer = new DispatcherTimer + { + Interval = new TimeSpan(0, 0, 0, 0, 500), + IsEnabled = false + }; public MainWindow() { InitializeComponent(); @@ -107,6 +133,12 @@ private void OnInitialized(object sender, EventArgs e) private void OnLoaded(object sender, RoutedEventArgs _) { + + // Remove OS minimizing/maximizing animation + IntPtr WinHandle = new WindowInteropHelper(this).Handle; + int BOOL_TRUE = 1; + DwmSetWindowAttribute(WinHandle, DWMWA_TRANSITIONS_FORCEDISABLED, ref BOOL_TRUE, Marshal.SizeOf(BOOL_TRUE)); + CheckFirstLaunch(); HideStartup(); // show notify icon when flowlauncher is hidden @@ -717,5 +749,62 @@ private void QueryTextBox_KeyUp(object sender, KeyEventArgs e) be.UpdateSource(); } } + + private void OnSizeChanged(object sender, SizeChangedEventArgs e) + { + /*_settings.WindowSize = Width;*/ + /*_settings.MaxResultsToShow = System.Convert.ToInt32(Height / _settings.ItemHeightSize);*/ + + /*FlowMainWindow.SizeToContent = SizeToContent.Height;*/ + /*IntPtr WinHandle = new WindowInteropHelper(this).Handle;*/ + /* + var backgroundBrush = FlowMainWindow.Resources["ApplicationBackgroundBrush"]; + backgroundBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x20, 0x20, 0x20)); + HwndSource.FromHwnd(WinHandle).CompositionTarget.BackgroundColor = Color.FromArgb(0xFF, 0x00, 0x00, 0x00); + WindowBackdrop.RemoveBackdrop(FlowMainWindow); + FlowMainWindow.Resources["ApplicationBackgroundColor"] = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);*/ + } + + private const int WM_ENTERSIZEMOVE = 0x0231; + private const int WM_EXITSIZEMOVE = 0x0232; + public event EventHandler ResizeBegin; + public event EventHandler ResizeEnd; + private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg == WM_ENTERSIZEMOVE) + { + OnResizeBegin(); + handled = true; + } + if (msg == WM_EXITSIZEMOVE) + { + OnResizeEnd(); + handled = true; + } + return IntPtr.Zero; + } + private void OnResizeBegin() + { + Debug.WriteLine("------------------RESIZE BEGIN-----------------------"); + //Any custom logic for resize begin + } + private void OnResizeEnd() + { + Debug.WriteLine("------------------END-----------------------"); + Debug.WriteLine(System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14)) / _settings.ItemHeightSize)); + Debug.WriteLine("----------------------------------------------------"); + //_settings.MaxResultsToShow = System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14)) / _settings.ItemHeightSize); + if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14)) / _settings.ItemHeightSize) == 0) + { + _settings.MaxResultsToShow = 1; + } + else + { + _settings.MaxResultsToShow = System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14)) / _settings.ItemHeightSize); + } + _settings.WindowSize = Width; + FlowMainWindow.SizeToContent = SizeToContent.Height; + //Any custom logic for resize begin + } } } diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index ba4c9e9a451..c16495332be 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -175,6 +175,7 @@ Grid.Row="0" VerticalAlignment="Center" DockPanel.Dock="Left" + FontSize="{Binding ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="False" Style="{DynamicResource ItemTitleStyle}" Text="{Binding Result.Title}" @@ -191,6 +192,7 @@ - + diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 96f80f0c5c6..596135b31d3 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -693,7 +693,7 @@ - @@ -720,7 +720,7 @@ -  +  - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + @@ -2006,37 +2255,6 @@ - - - - - - - - - - - -  - - - @@ -2191,109 +2409,8 @@ - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - -  - - - + @@ -2446,8 +2563,7 @@ FontSize="14" ItemsSource="{Binding AnimationSpeeds}" SelectedValue="{Binding Settings.AnimationSpeed}" - SelectedValuePath="Value"> - + SelectedValuePath="Value" /> + + + - - - - - - - - - - - - - - - - - - - #19ffffff - - - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/BlurBlack.xaml b/Flow.Launcher/Themes/BlurBlack.xaml deleted file mode 100644 index 0f126429242..00000000000 --- a/Flow.Launcher/Themes/BlurBlack.xaml +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - True - - - - - - - - - - - - - - - - - - - - #19c9c9c9 - - - - - - - - - - - - - \ No newline at end of file diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml deleted file mode 100644 index 4406724b8ec..00000000000 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/Bullet Light.xaml b/Flow.Launcher/Themes/Bullet Light.xaml deleted file mode 100644 index 1f776a2eee4..00000000000 --- a/Flow.Launcher/Themes/Bullet Light.xaml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - #f1f1f1 - - - - - - - - - - 5 - 10 0 10 0 - 0 0 0 10 - - - - - - - - \ No newline at end of file diff --git a/Flow.Launcher/Themes/Circle System.xaml b/Flow.Launcher/Themes/Circle System.xaml index 2b2ce7ca33d..ee64c73a144 100644 --- a/Flow.Launcher/Themes/Circle System.xaml +++ b/Flow.Launcher/Themes/Circle System.xaml @@ -87,7 +87,7 @@ TargetType="{x:Type TextBlock}"> - + - - - - - - - - - - - - - - #1e292f - - - - - - - - - - 0 - 0 - 0 0 0 4 - - - - - - - - \ No newline at end of file diff --git a/Flow.Launcher/Themes/Darker Glass.xaml b/Flow.Launcher/Themes/Darker Glass.xaml deleted file mode 100644 index 89b6dfa0181..00000000000 --- a/Flow.Launcher/Themes/Darker Glass.xaml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - 0 0 0 8 - - - - - - - - - - - - - - #545454 - - - - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/Darker.xaml b/Flow.Launcher/Themes/Darker.xaml deleted file mode 100644 index d1abbe9789f..00000000000 --- a/Flow.Launcher/Themes/Darker.xaml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - 0 0 0 8 - - - - - - - - #4d4d4d - - - - - - diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml deleted file mode 100644 index 5315c7644a1..00000000000 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - 0 0 0 6 - - - - - - - - - - - - - - #49443c - - - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/Gray.xaml b/Flow.Launcher/Themes/Gray.xaml deleted file mode 100644 index d8d344e216d..00000000000 --- a/Flow.Launcher/Themes/Gray.xaml +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - #797d86 - - - - - - - - - - 0 - 0 - 0 0 0 0 - - - - - - - - - diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml deleted file mode 100644 index 7fbe56187ad..00000000000 --- a/Flow.Launcher/Themes/League.xaml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - #192026 - - - - - - F1 M12000,12000z M0,0z M10354,10962C10326,10951 10279,10927 10249,10907 10216,10886 9476,10153 8370,9046 7366,8042 6541,7220 6536,7220 6532,7220 6498,7242 6461,7268 6213,7447 5883,7619 5592,7721 5194,7860 4802,7919 4360,7906 3612,7886 2953,7647 2340,7174 2131,7013 1832,6699 1664,6465 1394,6088 1188,5618 1097,5170 1044,4909 1030,4764 1030,4470 1030,4130 1056,3914 1135,3609 1263,3110 1511,2633 1850,2235 1936,2134 2162,1911 2260,1829 2781,1395 3422,1120 4090,1045 4271,1025 4667,1025 4848,1045 5505,1120 6100,1368 6630,1789 6774,1903 7081,2215 7186,2355 7362,2588 7467,2759 7579,2990 7802,3455 7911,3937 7911,4460 7911,4854 7861,5165 7737,5542 7684,5702 7675,5724 7602,5885 7517,6071 7390,6292 7270,6460 7242,6499 7220,6533 7220,6538 7220,6542 8046,7371 9055,8380 10441,9766 10898,10229 10924,10274 10945,10308 10966,10364 10976,10408 10990,10472 10991,10493 10980,10554 10952,10717 10840,10865 10690,10937 10621,10971 10607,10974 10510,10977 10425,10980 10395,10977 10354,10962z M4685,7050C5214,7001 5694,6809 6100,6484 6209,6396 6396,6209 6484,6100 7151,5267 7246,4110 6721,3190 6369,2571 5798,2137 5100,1956 4706,1855 4222,1855 3830,1957 3448,2056 3140,2210 2838,2453 2337,2855 2010,3427 1908,4080 1877,4274 1877,4656 1908,4850 1948,5105 2028,5370 2133,5590 2459,6272 3077,6782 3810,6973 3967,7014 4085,7034 4290,7053 4371,7061 4583,7059 4685,7050z - - - - - - - - \ No newline at end of file diff --git a/Flow.Launcher/Themes/Midnight.xaml b/Flow.Launcher/Themes/Midnight.xaml deleted file mode 100644 index 91ff620d54e..00000000000 --- a/Flow.Launcher/Themes/Midnight.xaml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - #202938 - - - - - - - - - - 8 - 10 0 10 0 - 0 0 0 10 - - - - - - - - diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml deleted file mode 100644 index d9ddb307664..00000000000 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - 0 0 0 8 - - - - - - - - - - - - - - #4e586b - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml deleted file mode 100644 index dc97e432055..00000000000 --- a/Flow.Launcher/Themes/Pink.xaml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - 0 0 0 4 - - - - - - - - - - - - - #cc1081 - - - - - - - - - - - - \ No newline at end of file diff --git a/Flow.Launcher/Themes/SlimLight.xaml b/Flow.Launcher/Themes/SlimLight.xaml deleted file mode 100644 index dc08eec3003..00000000000 --- a/Flow.Launcher/Themes/SlimLight.xaml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - 38 - - - - - - - - - - - - - - #d6d4d7 - - - - - - - - - - - 6 - 4 0 4 0 - 0 0 0 4 - - - - - - - - diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml deleted file mode 100644 index 6df69ad3e72..00000000000 --- a/Flow.Launcher/Themes/Sublime.xaml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - 0 0 0 8 - - - - - - - - - - - - - - - #3c454e - - - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/Ubuntu.xaml b/Flow.Launcher/Themes/Ubuntu.xaml deleted file mode 100644 index 33f232699a4..00000000000 --- a/Flow.Launcher/Themes/Ubuntu.xaml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - #4d4d4d - - - - - - - - - - 0 - 0 0 0 0 - 0 0 0 8 - - - - - - - - \ No newline at end of file diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml deleted file mode 100644 index eaa66e7fda5..00000000000 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - 0 0 0 4 - - - - - - - - - - - - - - - - #ccd0d4 - - - - - - - - - - - - - - - diff --git a/Flow.Launcher/Themes/Win11Dark.xaml b/Flow.Launcher/Themes/Win11Dark.xaml index 5abb96cce0d..041ca8f4b1e 100644 --- a/Flow.Launcher/Themes/Win11Dark.xaml +++ b/Flow.Launcher/Themes/Win11Dark.xaml @@ -28,7 +28,6 @@ x:Key="QuerySuggestionBoxStyle" BasedOn="{StaticResource BaseQuerySuggestionBoxStyle}" TargetType="{x:Type TextBox}"> - @@ -41,7 +40,7 @@ - + - + + - + TargetType="{x:Type Window}" /> + - - - - + + + + + + + 4 + 10 0 10 0 + 0 0 0 10 + - + \ No newline at end of file diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 9b799e5824f..022bbf82f29 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -71,6 +71,21 @@ public MainViewModel(Settings settings) case nameof(Settings.WindowSize): OnPropertyChanged(nameof(MainWindowWidth)); break; + case nameof(Settings.WindowHeightSize): + OnPropertyChanged(nameof(MainWindowHeight)); + break; + case nameof(Settings.QueryBoxFontSize): + OnPropertyChanged(nameof(QueryBoxFontSize)); + break; + case nameof(Settings.ItemHeightSize): + OnPropertyChanged(nameof(ItemHeightSize)); + break; + case nameof(Settings.ResultItemFontSize): + OnPropertyChanged(nameof(ResultItemFontSize)); + break; + case nameof(Settings.ResultSubItemFontSize): + OnPropertyChanged(nameof(ResultSubItemFontSize)); + break; case nameof(Settings.AlwaysStartEn): OnPropertyChanged(nameof(StartWithEnglishMode)); break; @@ -623,6 +638,42 @@ public double MainWindowWidth set => Settings.WindowSize = value; } + public double MainWindowHeight + { + get => Settings.WindowHeightSize; + set => Settings.WindowHeightSize = value; + } + + public double QueryBoxFontSize + { + get => Settings.QueryBoxFontSize; + set => Settings.QueryBoxFontSize = value; + } + + public double ItemHeightSize + { + get => Settings.ItemHeightSize; + set => Settings.ItemHeightSize = value; + } + + public double ResultItemFontSize + { + get => Settings.ResultItemFontSize; + set => Settings.ResultItemFontSize = value; + } + + public double ResultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set => Settings.ResultSubItemFontSize = value; + } + + public WindowStyle MainWindowStyle + { + get => Settings.WindowStyle; + set => Settings.WindowStyle = value; + } + public string PluginIconPath { get; set; } = null; public string OpenResultCommandModifiers => Settings.OpenResultModifiers; @@ -1062,7 +1113,7 @@ public void Show() { MainWindowVisibility = Visibility.Visible; - MainWindowOpacity = 1; + //MainWindowOpacity = 1; MainWindowVisibilityStatus = true; VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true }); @@ -1072,7 +1123,7 @@ public void Show() public async void Hide() { // Trick for no delay - MainWindowOpacity = 0; + //MainWindowOpacity = 0; lastContextMenuResult = new Result(); lastContextMenuResults = new List(); diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 3f204c16cc6..ab5f420ba5b 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -21,6 +21,22 @@ public ResultViewModel(Result result, Settings settings) { Settings = settings; + Settings.PropertyChanged += (_, args) => + { + switch (args.PropertyName) + { + case nameof(Settings.ItemHeightSize): + OnPropertyChanged(nameof(ItemHeightSize)); + break; + case nameof(Settings.ResultItemFontSize): + OnPropertyChanged(nameof(ResultItemFontSize)); + break; + case nameof(Settings.ResultSubItemFontSize): + OnPropertyChanged(nameof(ResultSubItemFontSize)); + break; + } + }; + if (result == null) { return; @@ -119,6 +135,23 @@ public double IconRadius } + public double ItemHeightSize + { + get => Settings.ItemHeightSize; + set => Settings.ItemHeightSize = value; + } + + public double ResultItemFontSize + { + get => Settings.ResultItemFontSize; + set => Settings.ResultItemFontSize = value; + } + + public double ResultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set => Settings.ResultSubItemFontSize = value; + } public Visibility ShowGlyph { get diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs index d02dc9bd582..a816faca952 100644 --- a/Flow.Launcher/ViewModel/ResultsViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs @@ -32,9 +32,15 @@ public ResultsViewModel(Settings settings) : this() _settings = settings; _settings.PropertyChanged += (s, e) => { - if (e.PropertyName == nameof(_settings.MaxResultsToShow)) + switch (e.PropertyName) { - OnPropertyChanged(nameof(MaxHeight)); + case nameof(_settings.MaxResultsToShow): + OnPropertyChanged(nameof(MaxHeight)); + break; + case nameof(_settings.ItemHeightSize): + OnPropertyChanged(nameof(ItemHeightSize)); + OnPropertyChanged(nameof(MaxHeight)); + break; } }; } @@ -43,8 +49,12 @@ public ResultsViewModel(Settings settings) : this() #region Properties - public double MaxHeight => MaxResults * (double)Application.Current.FindResource("ResultItemHeight")!; - + public double MaxHeight => MaxResults * _settings.ItemHeightSize!; + public double ItemHeightSize + { + get => _settings.ItemHeightSize; + set => _settings.ItemHeightSize = value; + } public int SelectedIndex { get; set; } public ResultViewModel SelectedItem { get; set; } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 86a25ffb118..01e770d01e4 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -47,6 +47,9 @@ public SettingWindowViewModel(Updater updater, IPortable portable) case nameof(Settings.WindowSize): OnPropertyChanged(nameof(WindowWidthSize)); break; + case nameof(Settings.WindowHeightSize): + OnPropertyChanged(nameof(WindowHeightSize)); + break; case nameof(Settings.UseDate): case nameof(Settings.DateFormat): OnPropertyChanged(nameof(DateText)); @@ -448,6 +451,34 @@ public class ColorScheme public ColorSchemes Value { get; set; } } + + public class ThemeMode + { + public string Display { get; set; } + public ThemeModes Value { get; set; } + } + + public List ThemeModes + { + get + { + List modes = new List(); + var enums = (ThemeModes[])Enum.GetValues(typeof(ThemeModes)); + foreach (var e in enums) + { + var key = $"ThemeMode{e}"; + var display = _translater.GetTranslation(key); + var m = new ThemeMode + { + Display = display, + Value = e, + }; + modes.Add(m); + } + return modes; + } + } + public List ColorSchemes { get @@ -589,6 +620,35 @@ public double WindowWidthSize set => Settings.WindowSize = value; } + public double WindowHeightSize + { + get => Settings.WindowHeightSize; + set => Settings.WindowHeightSize = value; + } + + public double ItemHeightSize + { + get => Settings.ItemHeightSize; + set => Settings.ItemHeightSize = value; + } + + public double queryBoxFontSize + { + get => Settings.QueryBoxFontSize; + set => Settings.QueryBoxFontSize = value; + } + public double resultItemFontSize + { + get => Settings.ResultItemFontSize; + set => Settings.ResultItemFontSize = value; + } + + public double resultSubItemFontSize + { + get => Settings.ResultSubItemFontSize; + set => Settings.ResultSubItemFontSize = value; + } + public bool UseGlyphIcons { get => Settings.UseGlyphIcons; @@ -606,7 +666,6 @@ public class AnimationSpeed public string Display { get; set; } public AnimationSpeeds Value { get; set; } } - public List AnimationSpeeds { get @@ -722,18 +781,6 @@ public ResultsViewModel PreviewResults Title = InternationalizationManager.Instance.GetTranslation("SampleTitleWebSearch"), SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleWebSearch"), IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png") - }, - new Result - { - Title = InternationalizationManager.Instance.GetTranslation("SampleTitleProgram"), - SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleProgram"), - IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.Program\Images\program.png") - }, - new Result - { - Title = InternationalizationManager.Instance.GetTranslation("SampleTitleProcessKiller"), - SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleProcessKiller"), - IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png") } }; var vm = new ResultsViewModel(Settings);