diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index e70de673e4c..4648aef637c 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -145,11 +145,9 @@ private ResourceDictionary CurrentThemeResourceDictionary() public ResourceDictionary GetResourceDictionary() { var dict = CurrentThemeResourceDictionary(); - - Style queryBoxStyle = dict["QueryBoxStyle"] as Style; - Style querySuggestionBoxStyle = dict["QuerySuggestionBoxStyle"] as Style; - - if (queryBoxStyle != null && querySuggestionBoxStyle != null) + + if (dict["QueryBoxStyle"] is Style queryBoxStyle && + dict["QuerySuggestionBoxStyle"] is Style querySuggestionBoxStyle) { var fontFamily = new FontFamily(Settings.QueryBoxFont); var fontStyle = FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.QueryBoxFontStyle); @@ -174,11 +172,12 @@ public ResourceDictionary GetResourceDictionary() querySuggestionBoxStyle.Setters.Add(new Setter(TextBox.FontStretchProperty, fontStretch)); } - Style resultItemStyle = dict["ItemTitleStyle"] as Style; - Style resultSubItemStyle = dict["ItemSubTitleStyle"] as Style; - Style resultItemSelectedStyle = dict["ItemTitleSelectedStyle"] as Style; - Style resultSubItemSelectedStyle = dict["ItemSubTitleSelectedStyle"] as Style; - if (resultItemStyle != null && resultSubItemStyle != null && resultSubItemSelectedStyle != null && resultItemSelectedStyle != null) + if (dict["ItemTitleStyle"] is Style resultItemStyle && + dict["ItemSubTitleStyle"] is Style resultSubItemStyle && + dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle && + dict["ItemTitleSelectedStyle"] is Style resultItemSelectedStyle && + dict["ItemHotkeyStyle"] is Style resultHotkeyItemStyle && + dict["ItemHotkeySelectedStyle"] is Style resultHotkeyItemSelectedStyle) { Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultFont)); Setter fontStyle = new Setter(TextBlock.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.ResultFontStyle)); @@ -186,7 +185,9 @@ public ResourceDictionary GetResourceDictionary() Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultFontStretch)); Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch }; - Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); + Array.ForEach( + new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o + => Array.ForEach(setters, p => o.Setters.Add(p))); } var windowStyle = dict["WindowStyle"] as Style; @@ -236,17 +237,19 @@ private string GetThemePath(string themeName) public void AddDropShadowEffectToCurrentTheme() { - var dict = CurrentThemeResourceDictionary(); + var dict = GetResourceDictionary(); var windowBorderStyle = dict["WindowBorderStyle"] as Style; - var effectSetter = new Setter(); - effectSetter.Property = Border.EffectProperty; - effectSetter.Value = new DropShadowEffect + var effectSetter = new Setter { - Opacity = 0.9, - ShadowDepth = 2, - BlurRadius = 15 + Property = Border.EffectProperty, + Value = new DropShadowEffect + { + Opacity = 0.4, + ShadowDepth = 2, + BlurRadius = 15 + } }; var marginSetter = windowBorderStyle.Setters.FirstOrDefault(setterBase => setterBase is Setter setter && setter.Property == Border.MarginProperty) as Setter; @@ -261,7 +264,7 @@ public void AddDropShadowEffectToCurrentTheme() } else { - var baseMargin = (Thickness) marginSetter.Value; + var baseMargin = (Thickness)marginSetter.Value; var newMargin = new Thickness( baseMargin.Left + ShadowExtraMargin, baseMargin.Top + ShadowExtraMargin, @@ -282,8 +285,8 @@ public void RemoveDropShadowEffectFromCurrentTheme() var effectSetter = windowBorderStyle.Setters.FirstOrDefault(setterBase => setterBase is Setter setter && setter.Property == Border.EffectProperty) as Setter; var marginSetter = windowBorderStyle.Setters.FirstOrDefault(setterBase => setterBase is Setter setter && setter.Property == Border.MarginProperty) as Setter; - - if(effectSetter != null) + + if (effectSetter != null) { windowBorderStyle.Setters.Remove(effectSetter); } @@ -371,11 +374,11 @@ private bool IsBlurTheme() private void SetWindowAccent(Window w, AccentState state) { var windowHelper = new WindowInteropHelper(w); - + // this determines the width of the main query window w.Width = mainWindowWidth; windowHelper.EnsureHandle(); - + var accent = new AccentPolicy { AccentState = state }; var accentStructSize = Marshal.SizeOf(accent); diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index ebef2c6315a..907314ba88e 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -32,6 +32,7 @@ public string Language public string ResultFontStyle { get; set; } public string ResultFontWeight { get; set; } public string ResultFontStretch { get; set; } + public bool UseGlyphIcons { get; set; } = true; /// diff --git a/Flow.Launcher/Converters/BorderClipConverter.cs b/Flow.Launcher/Converters/BorderClipConverter.cs new file mode 100644 index 00000000000..83e83f1de04 --- /dev/null +++ b/Flow.Launcher/Converters/BorderClipConverter.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using System.Windows.Documents; +using System.Windows.Shapes; + +// For Clipping inside listbox item + +namespace Flow.Launcher.Converters +{ + public class BorderClipConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values.Length == 3 && values[0] is double && values[1] is double && values[2] is CornerRadius) + { + var width = (double)values[0]; + var height = (double)values[1]; + Path myPath = new Path(); + if (width < Double.Epsilon || height < Double.Epsilon) + { + return Geometry.Empty; + } + var radius = (CornerRadius)values[2]; + var radiusHeight = radius.TopLeft; + + // Drawing Round box for bottom round, and rect for top area of listbox. + var corner = new RectangleGeometry(new Rect(0, 0, width, height), radius.TopLeft, radius.TopLeft); + var box = new RectangleGeometry(new Rect(0, 0, width, radiusHeight), 0, 0); + + GeometryGroup myGeometryGroup = new GeometryGroup(); + myGeometryGroup.Children.Add(corner); + myGeometryGroup.Children.Add(box); + + CombinedGeometry c1 = new CombinedGeometry(GeometryCombineMode.Union, corner, box); + myPath.Data = c1; + + myPath.Data.Freeze(); + return myPath.Data; + } + + return DependencyProperty.UnsetValue; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); + } + } + +} diff --git a/Flow.Launcher/Converters/HighlightTextConverter.cs b/Flow.Launcher/Converters/HighlightTextConverter.cs index 006e523200b..972dd1bc83e 100644 --- a/Flow.Launcher/Converters/HighlightTextConverter.cs +++ b/Flow.Launcher/Converters/HighlightTextConverter.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Data; +using System.Windows.Media; using System.Windows.Documents; namespace Flow.Launcher.Converters @@ -30,7 +31,9 @@ public object Convert(object[] value, Type targetType, object parameter, Culture var currentCharacter = text.Substring(i, 1); if (this.ShouldHighlight(highlightData, i)) { - textBlock.Inlines.Add(new Bold(new Run(currentCharacter))); + + textBlock.Inlines.Add(new Run(currentCharacter) { Style = (Style)Application.Current.FindResource("HighlightStyle") }); + } else { diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 529fc52a2ee..edf41e1938b 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -77,6 +77,9 @@ Designer PreserveNewest + + PreserveNewest + diff --git a/Flow.Launcher/HotkeyControl.xaml b/Flow.Launcher/HotkeyControl.xaml index e732cbe97e9..ab786fd5657 100644 --- a/Flow.Launcher/HotkeyControl.xaml +++ b/Flow.Launcher/HotkeyControl.xaml @@ -9,11 +9,11 @@ d:DesignHeight="300" d:DesignWidth="300"> - + - - + + \ No newline at end of file diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 90a920e3ed4..4a9b9270071 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -38,7 +38,7 @@ Hide tray icon Query Search Precision Should Use Pinyin - Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for transliterating Chinese + Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese Shadow effect is not allowed while current theme has blur effect enabled @@ -81,8 +81,9 @@ Please select an item Are you sure you want to delete {0} plugin hotkey? Query window shadow effect - Shadow effect has a substantial usage of GPU. - Not recommended if your computer performance is limited. + Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. + Use Segoe Fluent Icons + Use Segoe Fluent Icons for query results where supported HTTP Proxy diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index 346c708377c..5e63020a886 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -81,8 +81,7 @@ Vyberte položku, prosím Ste si istý, že chcete odstrániť klávesovú skratku {0} pre plugin? Tieňový efekt v poli vyhľadávania - Tieňový efekt významne využíva GPU. - Neodporúča sa, ak je výkon počítača obmedzený. + Tieňový efekt významne využíva GPU. Neodporúča sa, ak je výkon počítača obmedzený. HTTP Proxy diff --git a/Flow.Launcher/Languages/zh-cn.xaml b/Flow.Launcher/Languages/zh-cn.xaml index efc7f19d9c6..0c2307dc51a 100644 --- a/Flow.Launcher/Languages/zh-cn.xaml +++ b/Flow.Launcher/Languages/zh-cn.xaml @@ -76,8 +76,7 @@ 请选择一项 你确定要删除插件 {0} 的热键吗? 查询窗口阴影效果 - 阴影效果将占用大量的GPU资源。 - 如果您的计算机性能有限,则不建议使用。 + 阴影效果将占用大量的GPU资源。 如果您的计算机性能有限,则不建议使用。 HTTP 代理 diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 83cc016bbbd..73b13be8c95 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -30,6 +30,7 @@ d:DataContext="{d:DesignInstance vm:MainViewModel}"> + @@ -45,6 +46,8 @@ + + @@ -62,13 +65,12 @@ - + + IsEnabled="False"> @@ -82,34 +84,67 @@ PreviewDragOver="OnPreviewDragOver" AllowDrop="True" Visibility="Visible" - Background="Transparent" - Margin="18,0,56,0"> + Background="Transparent"> - + + - + + + - + + - - - - - - - - - - + Y1="0" Y2="0" X1="-150" X2="-50" Height="2" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}},Path=ActualWidth}" StrokeThickness="1"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 7521c65d250..e84a3148e2d 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -207,9 +207,9 @@ private void InitializeNotifyIcon() private void InitProgressbarAnimation() { - var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, + var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 150, new Duration(new TimeSpan(0, 0, 0, 0, 1600))); - var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth, new Duration(new TimeSpan(0, 0, 0, 0, 1600))); + var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 50, new Duration(new TimeSpan(0, 0, 0, 0, 1600))); Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)")); Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)")); _progressBarStoryboard.Children.Add(da); @@ -313,25 +313,43 @@ private double WindowTop() /// private void OnKeyDown(object sender, KeyEventArgs e) { - if (e.Key == Key.Down) + switch (e.Key) { - _viewModel.SelectNextItemCommand.Execute(null); - e.Handled = true; - } - else if (e.Key == Key.Up) - { - _viewModel.SelectPrevItemCommand.Execute(null); - e.Handled = true; - } - else if (e.Key == Key.PageDown) - { - _viewModel.SelectNextPageCommand.Execute(null); - e.Handled = true; - } - else if (e.Key == Key.PageUp) - { - _viewModel.SelectPrevPageCommand.Execute(null); - e.Handled = true; + case Key.Down: + _viewModel.SelectNextItemCommand.Execute(null); + e.Handled = true; + break; + case Key.Up: + _viewModel.SelectPrevItemCommand.Execute(null); + e.Handled = true; + break; + case Key.PageDown: + _viewModel.SelectNextPageCommand.Execute(null); + e.Handled = true; + break; + case Key.PageUp: + _viewModel.SelectPrevPageCommand.Execute(null); + e.Handled = true; + break; + case Key.Right: + if (_viewModel.SelectedIsFromQueryResults() + && QueryTextBox.CaretIndex == QueryTextBox.Text.Length + && !string.IsNullOrEmpty(QueryTextBox.Text)) + { + _viewModel.LoadContextMenuCommand.Execute(null); + e.Handled = true; + } + break; + case Key.Left: + if (!_viewModel.SelectedIsFromQueryResults() && QueryTextBox.CaretIndex == 0) + { + _viewModel.EscCommand.Execute(null); + e.Handled = true; + } + break; + default: + break; + } } diff --git a/Flow.Launcher/Resources/Segoe Fluent Icons.ttf b/Flow.Launcher/Resources/Segoe Fluent Icons.ttf new file mode 100644 index 00000000000..8f05a4bbc13 Binary files /dev/null and b/Flow.Launcher/Resources/Segoe Fluent Icons.ttf differ diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index dfee8981072..d52474d3f44 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -20,6 +20,7 @@ IsSynchronizedWithCurrentItem="True" PreviewMouseDown="ListBox_PreviewMouseDown"> + - + + @@ -104,7 +110,7 @@ + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + + + + + + +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + + + + + + + +  + + + + + + + + + + + +  + + + + + + + + + + + +  + + + + + + + + + + - - - - + + + + + + + - - - - + + + + + + + + +  + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + - - - - - + Style="{DynamicResource QueryBoxStyle}"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + +  + + + + + + - - - - + + + + + + + + + +  + + + + + + + + + - + - - - - - - - - + Width="130" Margin="10 0 0 0"> + + + + + + + + + + + + + + +  + - - - - - - - + + + + + + - + - - - - - - - - + Width="130" Margin="10 -2 0 0"> + + + + + + + + + + + + + + +  + - - - + + + + + + + + + + + + +  + + + + - - - + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - -