Merge pull request #2699 from onesounds/240514ResizableWindow

Resizable Window + Customize
This commit is contained in:
DB P 2024-05-28 12:04:58 +09:00 committed by GitHub
commit c9061a4303
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1232 additions and 618 deletions

View file

@ -176,8 +176,6 @@ namespace Flow.Launcher.Core.Resource
}
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)
@ -189,9 +187,25 @@ namespace Flow.Launcher.Core.Resource
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch };
Array.ForEach(
new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
new[] { resultItemStyle, resultItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
=> Array.ForEach(setters, p => o.Setters.Add(p)));
}
if (
dict["ItemSubTitleStyle"] is Style resultSubItemStyle &&
dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle)
{
Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultSubFont));
Setter fontStyle = new Setter(TextBlock.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.ResultSubFontStyle));
Setter fontWeight = new Setter(TextBlock.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(Settings.ResultSubFontWeight));
Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultSubFontStretch));
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch };
Array.ForEach(
new[] { resultSubItemStyle,resultSubItemSelectedStyle}, o
=> Array.ForEach(setters, p => o.Setters.Add(p)));
}
/* Ignore Theme Window Width and use setting */
var windowStyle = dict["WindowStyle"] as Style;
var width = Settings.WindowSize;

View file

@ -56,6 +56,13 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
}
public bool UseDropShadowEffect { get; set; } = false;
/* Appearance Settings. It should be separated from the setting later.*/
public double WindowHeightSize { get; set; } = 42;
public double ItemHeightSize { get; set; } = 58;
public double QueryBoxFontSize { get; set; } = 20;
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; }
@ -64,6 +71,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public string ResultFontStyle { get; set; }
public string ResultFontWeight { get; set; }
public string ResultFontStretch { get; set; }
public string ResultSubFont { get; set; } = FontFamily.GenericSansSerif.Name;
public string ResultSubFontStyle { get; set; }
public string ResultSubFontWeight { get; set; }
public string ResultSubFontStretch { get; set; }
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public bool UseSound { get; set; } = true;
@ -205,6 +216,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
/// </summary>
public double CustomWindowTop { get; set; } = 0;
public bool KeepMaxResults { get; set; } = false;
public int MaxResultsToShow { get; set; } = 5;
public int ActivateTimes { get; set; }

View file

@ -56,6 +56,8 @@
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
<system:String x:Key="KeepMaxResultsToolTip">The window height will not be resizeable by dragging</system:String>
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
@ -145,8 +147,13 @@
<system:String x:Key="SampleSubTitleProgram">Launch programs as admin or a different user</system:String>
<system:String x:Key="SampleTitleProcessKiller">ProcessKiller</system:String>
<system:String x:Key="SampleSubTitleProcessKiller">Terminate unwanted processes</system:String>
<system:String x:Key="SearchBarHeight">Search Bar Height</system:String>
<system:String x:Key="ItemHeight">Item Height</system:String>
<system:String x:Key="queryBoxFont">Query Box Font</system:String>
<system:String x:Key="resultItemFont">Result Item Font</system:String>
<system:String x:Key="resultItemFont">Result Title Font</system:String>
<system:String x:Key="resultSubItemFont">Result Subtitle Font</system:String>
<system:String x:Key="resetCustomize">Reset</system:String>
<system:String x:Key="CustomizeToolTip">Customize</system:String>
<system:String x:Key="windowMode">Window Mode</system:String>
<system:String x:Key="opacity">Opacity</system:String>
<system:String x:Key="theme_load_failure_path_not_exists">Theme {0} not exists, fallback to default theme</system:String>
@ -173,6 +180,7 @@
<system:String x:Key="Clock">Clock</system:String>
<system:String x:Key="Date">Date</system:String>
<!-- Setting Hotkey -->
<system:String x:Key="hotkey">Hotkey</system:String>
<system:String x:Key="hotkeys">Hotkeys</system:String>

View file

@ -12,8 +12,9 @@
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
Name="FlowMainWindow"
Title="Flow Launcher"
MinWidth="{Binding MainWindowWidth, Mode=OneWay}"
MaxWidth="{Binding MainWindowWidth, Mode=OneWay}"
Width="{Binding MainWindowWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
MinWidth="430"
MinHeight="30"
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
AllowDrop="True"
AllowsTransparency="True"
@ -27,15 +28,18 @@
Opacity="{Binding MainWindowOpacity, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
PreviewKeyDown="OnKeyDown"
PreviewKeyUp="OnKeyUp"
ResizeMode="NoResize"
ResizeMode="CanResize"
ShowInTaskbar="False"
SizeToContent="Height"
Style="{DynamicResource WindowStyle}"
Topmost="True"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
WindowStartupLocation="Manual"
WindowStyle="None"
mc:Ignorable="d">
<!-- WindowChrome -->
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="9" ResizeBorderThickness="32 4 32 32" />
</WindowChrome.WindowChrome>
<Window.Resources>
<converters:QuerySuggestionBoxConverter x:Key="QuerySuggestionBoxConverter" />
<converters:BorderClipConverter x:Key="BorderClipConverter" />
@ -208,311 +212,315 @@
Command="{Binding ForwardHistoryCommand}"
Modifiers="{Binding CycleHistoryDownHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
</Window.InputBindings>
<Grid>
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">
<StackPanel Orientation="Vertical">
<Grid>
<Border Style="{DynamicResource QueryBoxBgStyle}">
<Grid>
<TextBox
x:Name="QueryTextSuggestionBox"
IsEnabled="False"
Style="{DynamicResource QuerySuggestionBoxStyle}">
<TextBox.Text>
<MultiBinding Converter="{StaticResource QuerySuggestionBoxConverter}">
<Binding ElementName="QueryTextBox" Mode="OneTime" />
<Binding ElementName="ResultListBox" Path="SelectedItem" />
<Binding ElementName="QueryTextBox" Path="Text" />
</MultiBinding>
</TextBox.Text>
</TextBox>
<TextBox
x:Name="QueryTextBox"
AllowDrop="True"
AutomationProperties.Name="{Binding Results.SelectedItem.Result.Title}"
InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}"
InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
PreviewDragOver="OnPreviewDragOver"
PreviewKeyUp="QueryTextBox_KeyUp"
Style="{DynamicResource QueryBoxStyle}"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="Visible">
<TextBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
</TextBox.CommandBindings>
<TextBox.ContextMenu>
<ContextMenu MinWidth="160">
<MenuItem Command="ApplicationCommands.Cut" Header="{DynamicResource cut}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe8c6;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Copy" Header="{DynamicResource copy}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe8c8;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Paste" Header="{DynamicResource paste}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe77f;" />
</MenuItem.Icon>
</MenuItem>
<Separator
Margin="0"
Padding="0,4,0,4"
Background="{DynamicResource ContextSeparator}" />
<MenuItem Click="OnContextMenusForSettingsClick" Header="{DynamicResource flowlauncher_settings}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe713;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding EscCommand}" Header="{DynamicResource closeWindow}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe711;" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
</Grid>
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">
<StackPanel Orientation="Vertical">
<Grid>
<Border MinHeight="30" Style="{DynamicResource QueryBoxBgStyle}">
<Grid>
<TextBox
x:Name="QueryTextSuggestionBox"
Height="{Binding MainWindowHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
FontSize="{Binding QueryBoxFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="False"
Style="{DynamicResource QuerySuggestionBoxStyle}">
<TextBox.Text>
<MultiBinding Converter="{StaticResource QuerySuggestionBoxConverter}">
<Binding ElementName="QueryTextBox" Mode="OneTime" />
<Binding ElementName="ResultListBox" Path="SelectedItem" />
<Binding ElementName="QueryTextBox" Path="Text" />
</MultiBinding>
</TextBox.Text>
</TextBox>
<TextBox
x:Name="QueryTextBox"
Height="{Binding MainWindowHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
AllowDrop="True"
AutomationProperties.Name="{Binding Results.SelectedItem.Result.Title}"
FontSize="{Binding QueryBoxFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}"
InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
PreviewDragOver="OnPreviewDragOver"
PreviewKeyUp="QueryTextBox_KeyUp"
Style="{DynamicResource QueryBoxStyle}"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="Visible"
WindowChrome.IsHitTestVisibleInChrome="True">
<TextBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
</TextBox.CommandBindings>
<TextBox.ContextMenu>
<ContextMenu MinWidth="160">
<MenuItem Command="ApplicationCommands.Cut" Header="{DynamicResource cut}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe8c6;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Copy" Header="{DynamicResource copy}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe8c8;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Paste" Header="{DynamicResource paste}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe77f;" />
</MenuItem.Icon>
</MenuItem>
<Separator
Margin="0"
Padding="0 4 0 4"
Background="{DynamicResource ContextSeparator}" />
<MenuItem Click="OnContextMenusForSettingsClick" Header="{DynamicResource flowlauncher_settings}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe713;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding EscCommand}" Header="{DynamicResource closeWindow}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe711;" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
</Grid>
</Border>
<StackPanel
x:Name="ClockPanel"
IsHitTestVisible="False"
Style="{DynamicResource ClockPanel}">
<TextBlock
x:Name="ClockBox"
Style="{DynamicResource ClockBox}"
Text="{Binding ClockText}"
Visibility="{Binding Settings.UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBlock
x:Name="DateBox"
Style="{DynamicResource DateBox}"
Text="{Binding DateText}"
Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<Border>
<Grid WindowChrome.IsHitTestVisibleInChrome="True">
<Image
x:Name="PluginActivationIcon"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Panel.ZIndex="2"
RenderOptions.BitmapScalingMode="HighQuality"
Source="{Binding PluginIconPath}"
Stretch="Uniform"
Style="{DynamicResource PluginActivationIcon}" />
<Canvas Style="{DynamicResource SearchIconPosition}">
<Path
Name="SearchIcon"
Margin="0"
Data="{DynamicResource SearchIconImg}"
Stretch="Fill"
Style="{DynamicResource SearchIconStyle}"
Visibility="{Binding SearchIconVisibility}" />
</Canvas>
</Grid>
</Border>
<Line
x:Name="ProgressBar"
Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}"
Height="2"
Margin="12 0 12 0"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
StrokeThickness="2"
Style="{DynamicResource PendingLineStyle}"
Visibility="{Binding ProgressBarVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
X1="-100"
X2="0"
Y1="0"
Y2="0" />
</Grid>
<Grid ClipToBounds="True">
<ContentControl>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=ResultListBox, Path=Visibility}" Value="Visible">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Visible">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=History, Path=Visibility}" Value="Visible">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
<Rectangle
Name="MiddleSeparator"
Width="Auto"
HorizontalAlignment="Stretch"
Style="{DynamicResource SeparatorStyle}" />
</ContentControl>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="100" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="0.85*" MinWidth="244" />
</Grid.ColumnDefinitions>
<StackPanel
x:Name="ResultArea"
Grid.Column="0"
Grid.ColumnSpan="{Binding ResultAreaColumn}">
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<ContentControl>
<flowlauncher:ResultListBox
x:Name="ResultListBox"
DataContext="{Binding Results}"
LeftClickResultCommand="{Binding LeftClickResultCommand}"
RightClickResultCommand="{Binding RightClickResultCommand}" />
</ContentControl>
</Border>
<StackPanel
x:Name="ClockPanel"
IsHitTestVisible="False"
Style="{DynamicResource ClockPanel}">
<TextBlock
x:Name="ClockBox"
Style="{DynamicResource ClockBox}"
Text="{Binding ClockText}"
Visibility="{Binding Settings.UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBlock
x:Name="DateBox"
Style="{DynamicResource DateBox}"
Text="{Binding DateText}"
Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<Border>
<Grid>
<Image
x:Name="PluginActivationIcon"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Panel.ZIndex="2"
RenderOptions.BitmapScalingMode="HighQuality"
Source="{Binding PluginIconPath}"
Stretch="Uniform"
Style="{DynamicResource PluginActivationIcon}" />
<Canvas Style="{DynamicResource SearchIconPosition}">
<Path
Name="SearchIcon"
Margin="0"
Data="{DynamicResource SearchIconImg}"
Stretch="Fill"
Style="{DynamicResource SearchIconStyle}"
Visibility="{Binding SearchIconVisibility}" />
</Canvas>
</Grid>
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<ContentControl>
<flowlauncher:ResultListBox
x:Name="ContextMenu"
DataContext="{Binding ContextMenu}"
LeftClickResultCommand="{Binding LeftClickResultCommand}"
RightClickResultCommand="{Binding RightClickResultCommand}" />
</ContentControl>
</Border>
<Line
x:Name="ProgressBar"
Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}"
Height="2"
Margin="12,0,12,0"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
StrokeThickness="2"
Style="{DynamicResource PendingLineStyle}"
Visibility="{Binding ProgressBarVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
X1="-100"
X2="0"
Y1="0"
Y2="0" />
</Grid>
<Grid ClipToBounds="True">
<ContentControl>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=ResultListBox, Path=Visibility}" Value="Visible">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Visible">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=History, Path=Visibility}" Value="Visible">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
<Rectangle
Name="MiddleSeparator"
Width="Auto"
HorizontalAlignment="Stretch"
Style="{DynamicResource SeparatorStyle}" />
</ContentControl>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="100" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="0.85*" MinWidth="244" />
</Grid.ColumnDefinitions>
<StackPanel
x:Name="ResultArea"
Grid.Column="0"
Grid.ColumnSpan="{Binding ResultAreaColumn}">
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<ContentControl>
<flowlauncher:ResultListBox
x:Name="ResultListBox"
DataContext="{Binding Results}"
LeftClickResultCommand="{Binding LeftClickResultCommand}"
RightClickResultCommand="{Binding RightClickResultCommand}" />
</ContentControl>
</Border>
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<ContentControl>
<flowlauncher:ResultListBox
x:Name="ContextMenu"
DataContext="{Binding ContextMenu}"
LeftClickResultCommand="{Binding LeftClickResultCommand}"
RightClickResultCommand="{Binding RightClickResultCommand}" />
</ContentControl>
</Border>
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<ContentControl>
<flowlauncher:ResultListBox
x:Name="History"
DataContext="{Binding History}"
LeftClickResultCommand="{Binding LeftClickResultCommand}"
RightClickResultCommand="{Binding RightClickResultCommand}" />
</ContentControl>
</Border>
</StackPanel>
<GridSplitter
Grid.Column="1"
Width="{Binding PreviewVisible, Converter={StaticResource SplitterConverter}}"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Background="Transparent"
ShowsPreview="True" />
<Grid
x:Name="Preview"
Grid.Column="2"
VerticalAlignment="Stretch"
Style="{DynamicResource PreviewArea}"
Visibility="{Binding PreviewVisible, Converter={StaticResource BoolToVisibilityConverter}}">
<Border
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
Style="{DynamicResource PreviewBorderStyle}"
Visibility="{Binding ShowDefaultPreview}">
<Grid
Margin="20,0,10,0"
VerticalAlignment="Stretch"
Background="Transparent">
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<ContentControl>
<flowlauncher:ResultListBox
x:Name="History"
DataContext="{Binding History}"
LeftClickResultCommand="{Binding LeftClickResultCommand}"
RightClickResultCommand="{Binding RightClickResultCommand}" />
</ContentControl>
</Border>
</StackPanel>
<GridSplitter
Grid.Column="1"
Width="{Binding PreviewVisible, Converter={StaticResource SplitterConverter}}"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Background="Transparent"
ShowsPreview="True" />
<Grid
x:Name="Preview"
Grid.Column="2"
VerticalAlignment="Stretch"
Style="{DynamicResource PreviewArea}"
Visibility="{Binding PreviewVisible, Converter={StaticResource BoolToVisibilityConverter}}">
<Border
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
Style="{DynamicResource PreviewBorderStyle}"
Visibility="{Binding ShowDefaultPreview}">
<Grid
Margin="20 0 10 0"
VerticalAlignment="Stretch"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock
x:Name="PreviewGlyphIcon"
Grid.Row="0"
Height="Auto"
Margin="0,16,0,0"
FontFamily="{Binding Glyph.FontFamily}"
Style="{DynamicResource PreviewGlyph}"
Text="{Binding Glyph.Glyph}"
Visibility="{Binding ShowGlyph}" />
<Image
x:Name="PreviewImageIcon"
Grid.Row="0"
MaxHeight="320"
Margin="0,16,0,0"
HorizontalAlignment="Center"
Source="{Binding PreviewImage}"
StretchDirection="DownOnly"
Visibility="{Binding ShowPreviewImage}">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="MaxWidth" Value="96" />
<Style.Triggers>
<DataTrigger Binding="{Binding UseBigThumbnail}" Value="True">
<Setter Property="MaxWidth" Value="{Binding ElementName=Preview, Path=ActualWidth}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<TextBlock
x:Name="PreviewTitle"
Grid.Row="1"
Margin="0,6,0,16"
HorizontalAlignment="Stretch"
Style="{DynamicResource PreviewItemTitleStyle}"
Text="{Binding Result.Title}"
TextAlignment="Center"
TextWrapping="Wrap" />
</Grid>
<StackPanel Grid.Row="1">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<TextBlock
x:Name="PreviewGlyphIcon"
Grid.Row="0"
Height="Auto"
Margin="0 16 0 0"
FontFamily="{Binding Glyph.FontFamily}"
Style="{DynamicResource PreviewGlyph}"
Text="{Binding Glyph.Glyph}"
Visibility="{Binding ShowGlyph}" />
<Image
x:Name="PreviewImageIcon"
Grid.Row="0"
MaxHeight="320"
Margin="0 16 0 0"
HorizontalAlignment="Center"
Source="{Binding PreviewImage}"
StretchDirection="DownOnly"
Visibility="{Binding ShowPreviewImage}">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="MaxWidth" Value="96" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=PreviewSubTitle, UpdateSourceTrigger=PropertyChanged, Path=Text.Length}" Value="0">
<Setter Property="Visibility" Value="Collapsed" />
<DataTrigger Binding="{Binding UseBigThumbnail}" Value="True">
<Setter Property="MaxWidth" Value="{Binding ElementName=Preview, Path=ActualWidth}" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<Separator Style="{DynamicResource PreviewSep}" />
<TextBlock
x:Name="PreviewSubTitle"
Style="{DynamicResource PreviewItemSubTitleStyle}"
Text="{Binding Result.SubTitle}" />
</StackPanel>
</Image.Style>
</Image>
<TextBlock
x:Name="PreviewTitle"
Grid.Row="1"
Margin="0 6 0 16"
HorizontalAlignment="Stretch"
Style="{DynamicResource PreviewItemTitleStyle}"
Text="{Binding Result.Title}"
TextAlignment="Center"
TextWrapping="Wrap" />
</Grid>
</Border>
<Border
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
Style="{DynamicResource PreviewBorderStyle}"
Visibility="{Binding ShowCustomizedPreview}">
<ContentControl Content="{Binding Result.PreviewPanel.Value}" />
</Border>
</Grid>
<StackPanel Grid.Row="1">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=PreviewSubTitle, UpdateSourceTrigger=PropertyChanged, Path=Text.Length}" Value="0">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<Separator Style="{DynamicResource PreviewSep}" />
<TextBlock
x:Name="PreviewSubTitle"
Style="{DynamicResource PreviewItemSubTitleStyle}"
Text="{Binding Result.SubTitle}" />
</StackPanel>
</Grid>
</Border>
<Border
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
Style="{DynamicResource PreviewBorderStyle}"
Visibility="{Binding ShowCustomizedPreview}">
<ContentControl Content="{Binding Result.PreviewPanel.Value}" />
</Border>
</Grid>
</StackPanel>
</Border>
</Grid>
</Grid>
</StackPanel>
</Border>
</Window>

View file

@ -63,13 +63,68 @@ namespace Flow.Launcher
InitSoundEffects();
DataObject.AddPastingHandler(QueryTextBox, OnPaste);
this.Loaded += (_, _) =>
{
var handle = new WindowInteropHelper(this).Handle;
var win = HwndSource.FromHwnd(handle);
win.AddHook(WndProc);
};
}
DispatcherTimer timer = new DispatcherTimer
{
Interval = new TimeSpan(0, 0, 0, 0, 500),
IsEnabled = false
};
public MainWindow()
{
InitializeComponent();
}
private const int WM_ENTERSIZEMOVE = 0x0231;
private const int WM_EXITSIZEMOVE = 0x0232;
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_ENTERSIZEMOVE)
{
handled = true;
}
if (msg == WM_EXITSIZEMOVE)
{
OnResizeEnd();
handled = true;
}
return IntPtr.Zero;
}
private void OnResizeEnd()
{
int shadowMargin = 0;
if (_settings.UseDropShadowEffect)
{
shadowMargin = 32;
}
if (!_settings.KeepMaxResults)
{
var itemCount = (Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize;
if (itemCount < 2)
{
_settings.MaxResultsToShow = 2;
}
else
{
_settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount));
}
}
_viewModel.MainWindowWidth = Width;
FlowMainWindow.SizeToContent = SizeToContent.Height;
}
private void OnCopy(object sender, ExecutedRoutedEventArgs e)
{
var result = _viewModel.Results.SelectedItem?.Result;
@ -96,7 +151,7 @@ namespace Flow.Launcher
e.DataObject = data;
}
}
private async void OnClosing(object sender, CancelEventArgs e)
{
_notifyIcon.Visible = false;
@ -557,11 +612,11 @@ namespace Flow.Launcher
{
_settings.WindowLeft = Left;
_settings.WindowTop = Top;
//This condition stops extra hide call when animator is on,
//This condition stops extra hide call when animator is on,
// which causes the toggling to occasional hide instead of show.
if (_viewModel.MainWindowVisibilityStatus)
{
// Need time to initialize the main query window animation.
// Need time to initialize the main query window animation.
// This also stops the mainwindow from flickering occasionally after Settings window is opened
// and always after Settings window is closed.
if (_settings.UseAnimation)
@ -632,7 +687,7 @@ namespace Flow.Launcher
}
return screen ?? Screen.AllScreens[0];
}
public double HorizonCenter(Screen screen)
{
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);

View file

@ -45,7 +45,7 @@
</Style>
<Style x:Key="Glyph" TargetType="{x:Type TextBlock}">
<Setter Property="Grid.Column" Value="0" />
<Setter Property="Margin" Value="24,0,16,0" />
<Setter Property="Margin" Value="24 0 16 0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="20" />
<Setter Property="FontFamily" Value="/Resources/#Segoe Fluent Icons" />
@ -57,7 +57,7 @@
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
</Style>
<Style x:Key="TabMenuIcon" TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="0,0,12,0" />
<Setter Property="Margin" Value="0 0 12 0" />
<Setter Property="FontSize" Value="16" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontFamily" Value="/Resources/#Segoe Fluent Icons" />
@ -149,7 +149,169 @@
</Setter>
</Style>
<!-- Repeat Button -->
<!-- Toggle Button -->
<Style x:Key="CustomToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundColor}" />
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ToggleButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="{DynamicResource ButtonPadding}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="ui:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
<Setter Property="ui:FocusVisualHelper.UseSystemFocusVisuals" Value="{DynamicResource UseSystemFocusVisuals}" />
<Setter Property="ui:FocusVisualHelper.FocusVisualMargin" Value="-3" />
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border
x:Name="Background"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}"
SnapsToDevicePixels="True">
<Border
x:Name="Border"
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}">
<ContentPresenter
x:Name="ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Border>
<ControlTemplate.Triggers>
<!-- PointerOver -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="False" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ButtonMouseOver}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushPointerOver}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundPointerOver}" />
</MultiTrigger>
<!-- Pressed -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="False" />
<Condition Property="IsPressed" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ButtonMousePressed}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushPressed}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundPressed}" />
</MultiTrigger>
<!-- Disabled -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="False" />
<Condition Property="IsEnabled" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundDisabled}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundDisabled}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushDisabled}" />
</MultiTrigger>
<!-- Checked -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True" />
<Condition Property="IsMouseOver" Value="False" />
<Condition Property="IsPressed" Value="False" />
<Condition Property="IsEnabled" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundChecked}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundChecked}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushChecked}" />
</MultiTrigger>
<!-- CheckedPointerOver -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedPointerOver}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedPointerOver}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedPointerOver}" />
</MultiTrigger>
<!-- CheckedPressed -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True" />
<Condition Property="IsPressed" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedPointerOver}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedPressed}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedPressed}" />
</MultiTrigger>
<!-- CheckedDisabled -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="True" />
<Condition Property="IsEnabled" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedDisabled}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedDisabled}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedDisabled}" />
</MultiTrigger>
<!-- Indeterminate -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="{x:Null}" />
<Condition Property="IsMouseOver" Value="False" />
<Condition Property="IsPressed" Value="False" />
<Condition Property="IsEnabled" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminate}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminate}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminate}" />
</MultiTrigger>
<!-- IndeterminatePointerOver -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="{x:Null}" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminatePointerOver}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminatePointerOver}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminatePointerOver}" />
</MultiTrigger>
<!-- IndeterminatePressed -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="{x:Null}" />
<Condition Property="IsPressed" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminatePressed}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminatePressed}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminatePressed}" />
</MultiTrigger>
<!-- IndeterminateDisabled -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="{x:Null}" />
<Condition Property="IsEnabled" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Background" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminateDisabled}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminateDisabled}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminateDisabled}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Radio Button -->
<Style x:Key="DefaultRadioButtonStyle" TargetType="RadioButton">
@ -157,7 +319,7 @@
<Setter Property="Background" Value="{DynamicResource RadioButtonBackground}" />
<Setter Property="Foreground" Value="{DynamicResource RadioButtonForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource RadioButtonBorderBrush}" />
<Setter Property="Padding" Value="8,6,0,0" />
<Setter Property="Padding" Value="8 6 0 0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
@ -301,7 +463,7 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxBackgroundUnchecked}" />
<Setter Property="Foreground" Value="{DynamicResource CheckBoxForegroundUnchecked}" />
<Setter Property="BorderBrush" Value="{DynamicResource CheckBoxBorderBrushUnchecked}" />
<Setter Property="Padding" Value="8,0,0,0" />
<Setter Property="Padding" Value="8 0 0 0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
@ -557,7 +719,7 @@
TargetType="CheckBox">
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Margin" Value="12,0" />
<Setter Property="Margin" Value="12 0" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
@ -867,7 +1029,7 @@
Grid.Row="1"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
Padding="0,0,32,0"
Padding="0 0 32 0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding ui:ControlHelper.PlaceholderForeground}"
@ -887,7 +1049,7 @@
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,0"
Margin="0 0 0 0"
Padding="{DynamicResource ComboBoxEditableTextPadding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@ -906,7 +1068,7 @@
Grid.Row="1"
Grid.Column="1"
Width="30"
Margin="0,1,1,1"
Margin="0 1 1 1"
HorizontalAlignment="Right"
Background="Transparent"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
@ -917,7 +1079,7 @@
Grid.Row="1"
Grid.Column="1"
MinHeight="{DynamicResource ComboBoxMinHeight}"
Margin="0,0,10,0"
Margin="0 0 10 0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Data="{StaticResource ChevronDown}"
@ -944,7 +1106,7 @@
<Popup.PlacementRectangle>
<MultiBinding>
<MultiBinding.Converter>
<ui:PlacementRectangleConverter Margin="-1,1,0,1" />
<ui:PlacementRectangleConverter Margin="-1 1 0 1" />
</MultiBinding.Converter>
<Binding ElementName="Background" Path="ActualWidth" />
<Binding ElementName="Background" Path="ActualHeight" />
@ -1063,7 +1225,7 @@
<Condition SourceName="DropDownOverlay" Property="IsPressed" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="DropDownGlyph" Property="Foreground" Value="{DynamicResource ComboBoxEditableDropDownGlyphForeground}" />
<Setter TargetName="DropDownOverlay" Property="Margin" Value="0,2,2,2" />
<Setter TargetName="DropDownOverlay" Property="Margin" Value="0 2 2 2" />
</MultiTrigger>
<!-- TextBoxFocusedOverlayPointerOver -->
<MultiTrigger>
@ -1073,7 +1235,7 @@
</MultiTrigger.Conditions>
<Setter TargetName="DropDownGlyph" Property="Foreground" Value="{DynamicResource ComboBoxEditableDropDownGlyphForeground}" />
<Setter TargetName="DropDownOverlay" Property="Background" Value="{DynamicResource ComboBoxFocusedDropDownBackgroundPointerOver}" />
<Setter TargetName="DropDownOverlay" Property="Margin" Value="0,2,2,2" />
<Setter TargetName="DropDownOverlay" Property="Margin" Value="0 2 2 2" />
</MultiTrigger>
<!-- TextBoxFocusedOverlayPressed -->
<MultiTrigger>
@ -1083,7 +1245,7 @@
</MultiTrigger.Conditions>
<Setter TargetName="DropDownGlyph" Property="Foreground" Value="{DynamicResource ComboBoxEditableDropDownGlyphForeground}" />
<Setter TargetName="DropDownOverlay" Property="Background" Value="{DynamicResource ComboBoxFocusedDropDownBackgroundPointerPressed}" />
<Setter TargetName="DropDownOverlay" Property="Margin" Value="0,2,2,2" />
<Setter TargetName="DropDownOverlay" Property="Margin" Value="0 2 2 2" />
</MultiTrigger>
<!-- TextBoxOverlayPointerOver -->
<MultiTrigger>
@ -1121,7 +1283,7 @@
x:Key="DataGridComboBoxStyle"
BasedOn="{StaticResource DefaultComboBoxStyle}"
TargetType="ComboBox">
<Setter Property="Padding" Value="12,0,0,0" />
<Setter Property="Padding" Value="12 0 0 0" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
@ -1133,7 +1295,7 @@
x:Key="DataGridTextBlockComboBoxStyle"
BasedOn="{StaticResource DefaultComboBoxStyle}"
TargetType="ComboBox">
<Setter Property="Padding" Value="12,0,0,0" />
<Setter Property="Padding" Value="12 0 0 0" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
@ -1362,7 +1524,7 @@
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundFocused}" />
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" />
<Setter TargetName="BorderElement" Property="BorderThickness" Value="0,0,0,2" />
<Setter TargetName="BorderElement" Property="BorderThickness" Value="0 0 0 2" />
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" />
</Trigger>
<MultiTrigger>
@ -1394,7 +1556,7 @@
BasedOn="{StaticResource DefaultTextBoxStyle}"
TargetType="TextBox">
<Setter Property="MinWidth" Value="0" />
<Setter Property="Padding" Value="11,0,6,0" />
<Setter Property="Padding" Value="11 0 6 0" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="ui:ControlHelper.CornerRadius" Value="0" />
@ -1549,7 +1711,7 @@
x:Name="SwitchAreaGrid"
Grid.RowSpan="3"
Grid.ColumnSpan="3"
Margin="0,5"
Margin="0 5"
HorizontalAlignment="Right"
ui:FocusVisualHelper.IsTemplateFocusTarget="True"
Background="{DynamicResource ToggleSwitchContainerBackground}" />
@ -1902,7 +2064,7 @@
</Grid>
<ContentPresenter
Grid.Row="1"
Margin="0,4,0,0"
Margin="0 4 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
RecognizesAccessKey="True"
@ -1965,7 +2127,7 @@
</Grid>
<ContentPresenter
Grid.Column="1"
Margin="4,0,0,0"
Margin="4 0 0 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
RecognizesAccessKey="True"
@ -2028,7 +2190,7 @@
</Grid>
<ContentPresenter
Grid.Row="1"
Margin="0,4,0,0"
Margin="0 4 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
RecognizesAccessKey="True"
@ -2081,7 +2243,7 @@
</Grid.ColumnDefinitions>
<ContentPresenter
Grid.Column="0"
Margin="0,0,0,0"
Margin="0 0 0 0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
@ -2154,7 +2316,7 @@
x:Name="HeaderSite"
MinWidth="0"
MinHeight="0"
Margin="18,0,18,0"
Margin="18 0 18 0"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
@ -2188,7 +2350,7 @@
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
<Setter TargetName="ContentPresenterBorder" Property="BorderThickness" Value="0,1,0,0" />
<Setter TargetName="ContentPresenterBorder" Property="BorderThickness" Value="0 1 0 0" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
@ -2673,7 +2835,7 @@
x:Name="UpSpinButton"
Grid.Row="1"
Grid.Column="1"
Margin="4,0,0,0"
Margin="4 0 0 0"
ui:ControlHelper.CornerRadius="4"
Content="{StaticResource ChevronUp}"
FontSize="{TemplateBinding FontSize}"
@ -2807,7 +2969,7 @@
BorderThickness="{TemplateBinding BorderThickness}" />
<ContentPresenter
Margin="12,0,12,0"
Margin="12 0 12 0"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ContentSource="Header"
RecognizesAccessKey="True"
@ -2837,7 +2999,7 @@
BorderThickness="{TemplateBinding BorderThickness}" />
<ContentPresenter
Margin="12,0,12,0"
Margin="12 0 12 0"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ContentSource="Header"
RecognizesAccessKey="True"
@ -2910,7 +3072,7 @@
<Border
x:Name="LayoutRoot"
Height="Auto"
Margin="5,2,5,2"
Margin="5 2 5 2"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
@ -2928,7 +3090,7 @@
</Grid.ColumnDefinitions>
<ui:FontIconFallback
x:Name="CheckGlyph"
Margin="0,0,16,0"
Margin="0 0 16 0"
Data="{StaticResource CheckMark}"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="12"
@ -2940,7 +3102,7 @@
Grid.Column="1"
Width="16"
Height="16"
Margin="0,1,12,0"
Margin="0 1 12 0"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
TextBlock.FontFamily="/Resources/#Segoe Fluent Icons">
@ -2961,7 +3123,7 @@
<TextBlock
x:Name="KeyboardAcceleratorTextBlock"
Grid.Column="3"
Margin="24,4,0,0"
Margin="24 4 0 0"
HorizontalAlignment="Right"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"
@ -3034,7 +3196,7 @@
Grid.Column="1"
Width="16"
Height="16"
Margin="0,0,12,0"
Margin="0 0 12 0"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<ContentPresenter
@ -3074,7 +3236,7 @@
<Popup.PlacementRectangle>
<MultiBinding>
<MultiBinding.Converter>
<ui:PlacementRectangleConverter Margin="4,-1" />
<ui:PlacementRectangleConverter Margin="4 -1" />
</MultiBinding.Converter>
<Binding ElementName="LayoutRoot" Path="ActualWidth" />
<Binding ElementName="LayoutRoot" Path="ActualHeight" />
@ -3219,7 +3381,7 @@
SnapsToDevicePixels="True">
<Border
x:Name="Border"
Padding="0,4,0,4"
Padding="0 4 0 4"
Background="{DynamicResource CustomContextBackground}"
BorderBrush="{DynamicResource CustomContextBorder}"
BorderThickness="1"
@ -3405,7 +3567,7 @@
<Button
x:Name="PrimaryButton"
Grid.Column="0"
Margin="0,0,2,0"
Margin="0 0 2 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{TemplateBinding PrimaryButtonText}"
@ -3415,7 +3577,7 @@
x:Name="SecondaryButton"
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="2,0,2,0"
Margin="2 0 2 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{TemplateBinding SecondaryButtonText}"
@ -3424,7 +3586,7 @@
<Button
x:Name="CloseButton"
Grid.Column="3"
Margin="2,0,0,0"
Margin="2 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{TemplateBinding CloseButtonText}"
@ -3886,7 +4048,7 @@
<Grid x:Name="PresenterContentRootGrid">
<!-- Wrap SelectionIndicator in a grid so that its offset is 0,0 - this enables the offset animation. -->
<Grid
Margin="0,0,0,0"
Margin="0 0 0 0"
HorizontalAlignment="Left"
VerticalAlignment="Center">
@ -4099,7 +4261,7 @@
Grid.Column="1"
Width="48"
Height="16"
Margin="0,0,0,0"
Margin="0 0 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ContentPresenter
@ -4207,7 +4369,7 @@
x:Name="IconBox"
Width="16"
Height="16"
Margin="16,0,0,0"
Margin="16 0 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ContentPresenter
@ -4250,7 +4412,7 @@
</Grid>
<Grid
x:Name="SelectionIndicatorGrid"
Margin="16,0,16,4"
Margin="16 0 16 4"
VerticalAlignment="Bottom">
<Rectangle
x:Name="SelectionIndicator"
@ -4346,13 +4508,13 @@
<Setter TargetName="PointerRectangle" Property="Visibility" Value="Visible" />
<Setter TargetName="LayoutRoot" Property="MinWidth" Value="48" />
<Setter TargetName="ContentPresenter" Property="Visibility" Value="Collapsed" />
<Setter TargetName="SelectionIndicatorGrid" Property="Margin" Value="4,0,4,4" />
<Setter TargetName="SelectionIndicatorGrid" Property="Margin" Value="4 0 4 4" />
<Setter TargetName="ExpandCollapseChevron" Property="Margin" Value="{DynamicResource TopNavigationViewItemIconOnlyExpandChevronMargin}" />
</Trigger>
<Trigger SourceName="NavigationViewIconPositionStatesListener" Property="CurrentStateName" Value="ContentOnly">
<Setter TargetName="IconBox" Property="Visibility" Value="Collapsed" />
<Setter TargetName="ContentPresenter" Property="Margin" Value="{DynamicResource TopNavigationViewItemContentOnlyContentPresenterMargin}" />
<Setter TargetName="SelectionIndicatorGrid" Property="Margin" Value="12,0,12,4" />
<Setter TargetName="SelectionIndicatorGrid" Property="Margin" Value="12 0 12 4" />
<Setter TargetName="ExpandCollapseChevron" Property="Margin" Value="{DynamicResource TopNavigationViewItemContentOnlyExpandChevronMargin}" />
</Trigger>
</ControlTemplate.Triggers>
@ -4391,7 +4553,7 @@
<Grid x:Name="PresenterContentRootGrid">
<!-- Wrap SelectionIndicator in a grid so that its offset is 0,0 - this enables the offset animation. -->
<Grid
Margin="4,0,0,0"
Margin="4 0 0 0"
HorizontalAlignment="Left"
VerticalAlignment="Center">
@ -4414,7 +4576,7 @@
x:Name="IconBox"
Width="16"
Height="16"
Margin="16,0,0,0"
Margin="16 0 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ContentPresenter
@ -4558,7 +4720,7 @@
<!-- Button grid -->
<Grid
x:Name="PaneToggleButtonGrid"
Margin="0,0,0,8"
Margin="0 0 0 8"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Canvas.ZIndex="100"
@ -4768,7 +4930,7 @@
<ui:SplitView.Pane>
<Grid
x:Name="PaneContentGrid"
Margin="12,0,12,0"
Margin="12 0 12 0"
HorizontalAlignment="Left"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.LeftPaneVisibility}">
<Grid.RowDefinitions>
@ -4841,7 +5003,7 @@
<Grid
x:Name="ItemsContainerGrid"
Grid.Row="6"
Margin="0,0,0,8">
Margin="0 0 0 8">
<Grid.RowDefinitions>
<RowDefinition
x:Name="MenuItemsRow"
@ -5235,7 +5397,7 @@
HorizontalAlignment="Left">
<TextBlock
x:Name="HeaderText"
Margin="0,-1,0,-1"
Margin="0 -1 0 -1"
VerticalAlignment="Center"
Style="{DynamicResource NavigationViewItemHeaderTextStyle}"
Text="{TemplateBinding Content}"

View file

@ -1033,7 +1033,8 @@
<!-- Resources for NavigationView -->
<m:StaticResource x:Key="NavigationViewDefaultPaneBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{m:StaticColor SystemChromeMediumColor}" />
<!--<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{m:StaticColor SystemChromeMediumColor}" />-->
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{m:StaticColor Color01}" />
<m:StaticResource x:Key="NavigationViewTopPaneBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<m:StaticResource x:Key="NavigationViewItemBackground" ResourceKey="SystemControlTransparentRevealBackgroundBrush" />

View file

@ -1030,7 +1030,8 @@
<!-- Resources for NavigationView -->
<m:StaticResource x:Key="NavigationViewDefaultPaneBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{m:StaticColor SystemChromeMediumColor}" />
<!--<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{m:StaticColor SystemChromeMediumColor}" />-->
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{m:StaticColor Color01}" />
<m:StaticResource x:Key="NavigationViewTopPaneBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<m:StaticResource x:Key="NavigationViewItemBackground" ResourceKey="SystemControlTransparentRevealBackgroundBrush" />

View file

@ -48,7 +48,6 @@
Margin="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Cursor="Hand"
UseLayoutRounding="False">
<Grid.Resources>
<converter:HighlightTextConverter x:Key="HighlightTextConverter" />
@ -173,8 +172,10 @@
<TextBlock
x:Name="Title"
Grid.Row="0"
VerticalAlignment="Center"
Margin="0,0,0,1"
VerticalAlignment="Bottom"
DockPanel.Dock="Left"
FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="False"
Style="{DynamicResource ItemTitleStyle}"
Text="{Binding Result.Title}"
@ -191,6 +192,9 @@
<TextBlock
x:Name="SubTitle"
Grid.Row="1"
Margin="0,1,0,0"
VerticalAlignment="Top"
FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="False"
Style="{DynamicResource ItemSubTitleStyle}"
Text="{Binding Result.SubTitle}"
@ -219,7 +223,7 @@
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="MouseEnter" Handler="OnMouseEnter" />
<EventSetter Event="MouseMove" Handler="OnMouseMove" />
<Setter Property="Height" Value="{DynamicResource ResultItemHeight}" />
<Setter Property="Height" Value="{Binding Settings.ItemHeightSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />

View file

@ -133,7 +133,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
}
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
public string AlwaysPreviewToolTip => string.Format(
InternationalizationManager.Instance.GetTranslation("AlwaysPreviewToolTip"),

View file

@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using CommunityToolkit.Mvvm.Input;
@ -62,6 +63,34 @@ public partial class SettingsPaneThemeViewModel : BaseModel
}
}
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 List<string> Themes =>
ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension).ToList();
@ -134,6 +163,12 @@ public partial class SettingsPaneThemeViewModel : BaseModel
set => Settings.DateFormat = value;
}
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
public bool KeepMaxResults
{
get => Settings.KeepMaxResults;
set => Settings.KeepMaxResults = value;
}
public string ClockText => DateTime.Now.ToString(TimeFormat, CultureInfo.CurrentCulture);
public string DateText => DateTime.Now.ToString(DateFormat, CultureInfo.CurrentCulture);
@ -373,6 +408,50 @@ public partial class SettingsPaneThemeViewModel : BaseModel
}
}
public FontFamily SelectedResultSubFont
{
get
{
if (Fonts.SystemFontFamilies.Count(o =>
o.FamilyNames.Values != null &&
o.FamilyNames.Values.Contains(Settings.ResultSubFont)) > 0)
{
var font = new FontFamily(Settings.ResultSubFont);
return font;
}
else
{
var font = new FontFamily("Segoe UI");
return font;
}
}
set
{
Settings.ResultSubFont = value.ToString();
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}
public FamilyTypeface SelectedResultSubFontFaces
{
get
{
var typeface = SyntaxSugars.CallOrRescueDefault(
() => SelectedResultSubFont.ConvertFromInvariantStringsOrNormal(
Settings.ResultSubFontStyle,
Settings.ResultSubFontWeight,
Settings.ResultSubFontStretch
));
return typeface;
}
set
{
Settings.ResultSubFontStretch = value.Stretch.ToString();
Settings.ResultSubFontWeight = value.Weight.ToString();
Settings.ResultSubFontStyle = value.Style.ToString();
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}
public string ThemeImage => Constant.QueryTextBoxIconImagePath;
[RelayCommand]
@ -396,4 +475,5 @@ public partial class SettingsPaneThemeViewModel : BaseModel
{
Settings = settings;
}
}

View file

@ -4,11 +4,11 @@
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:ext="clr-namespace:Flow.Launcher.Resources.MarkupExtensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settingsViewModels="clr-namespace:Flow.Launcher.SettingPages.ViewModels"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
xmlns:ext="clr-namespace:Flow.Launcher.Resources.MarkupExtensions"
Title="General"
d:DataContext="{d:DesignInstance settingsViewModels:SettingsPaneGeneralViewModel}"
d:DesignHeight="450"
@ -58,58 +58,62 @@
</cc:Card>
<cc:CardGroup Margin="0 30 0 0">
<cc:Card Icon="&#xe7f4;" Title="{DynamicResource SearchWindowPosition}">
<cc:Card Title="{DynamicResource SearchWindowPosition}" Icon="&#xe7f4;">
<StackPanel Orientation="Horizontal">
<ComboBox
MinWidth="220"
DisplayMemberPath="Display"
SelectedValuePath="Value"
FontSize="14"
VerticalAlignment="Center"
DisplayMemberPath="Display"
FontSize="14"
ItemsSource="{Binding SearchWindowScreens}"
SelectedValue="{Binding Settings.SearchWindowScreen}" />
SelectedValue="{Binding Settings.SearchWindowScreen}"
SelectedValuePath="Value" />
<ComboBox
MinWidth="160"
Margin="18 0 0 0"
FontSize="14"
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding ScreenNumbers}"
SelectedValue="{Binding Settings.CustomScreenNumber}"
Visibility="{ext:VisibleWhen
{Binding Settings.SearchWindowScreen},
IsEqualTo={x:Static userSettings:SearchWindowScreens.Custom}}"
/>
Visibility="{ext:VisibleWhen {Binding Settings.SearchWindowScreen},
IsEqualTo={x:Static userSettings:SearchWindowScreens.Custom}}" />
</StackPanel>
</cc:Card>
<cc:Card
Icon="&#xe7f4;"
Title="{DynamicResource SearchWindowAlign}"
Visibility="{ext:CollapsedWhen
{Binding Settings.SearchWindowScreen},
IsEqualTo={x:Static userSettings:SearchWindowScreens.RememberLastLaunchLocation}}">
Icon="&#xe7f4;"
Visibility="{ext:CollapsedWhen {Binding Settings.SearchWindowScreen},
IsEqualTo={x:Static userSettings:SearchWindowScreens.RememberLastLaunchLocation}}">
<StackPanel Orientation="Horizontal">
<ComboBox
MinWidth="160"
DisplayMemberPath="Display"
SelectedValuePath="Value"
FontSize="14"
VerticalAlignment="Center"
DisplayMemberPath="Display"
FontSize="14"
ItemsSource="{Binding SearchWindowAligns}"
SelectedValue="{Binding Settings.SearchWindowAlign}" />
SelectedValue="{Binding Settings.SearchWindowAlign}"
SelectedValuePath="Value" />
<StackPanel
Margin="18 0 0 0"
Orientation="Horizontal"
VerticalAlignment="Center"
Visibility="{ext:VisibleWhen
{Binding Settings.SearchWindowAlign},
IsEqualTo={x:Static userSettings:SearchWindowAligns.Custom}}">
<TextBox VerticalAlignment="Center" MinWidth="80"
Text="{Binding Settings.CustomWindowLeft}" />
<TextBlock VerticalAlignment="Center" Margin="10" Text="x" />
<TextBox VerticalAlignment="Center" MinWidth="80" Text="{Binding Settings.CustomWindowTop}"
TextWrapping="NoWrap" />
Orientation="Horizontal"
Visibility="{ext:VisibleWhen {Binding Settings.SearchWindowAlign},
IsEqualTo={x:Static userSettings:SearchWindowAligns.Custom}}">
<TextBox
MinWidth="80"
VerticalAlignment="Center"
Text="{Binding Settings.CustomWindowLeft}" />
<TextBlock
Margin="10"
VerticalAlignment="Center"
Text="x" />
<TextBox
MinWidth="80"
VerticalAlignment="Center"
Text="{Binding Settings.CustomWindowTop}"
TextWrapping="NoWrap" />
</StackPanel>
</StackPanel>
</cc:Card>
@ -158,8 +162,7 @@
</cc:Card>
<cc:CardGroup Margin="0 30 0 0">
<cc:Card Title="{DynamicResource querySearchPrecision}"
Sub="{DynamicResource querySearchPrecisionToolTip}">
<cc:Card Title="{DynamicResource querySearchPrecision}" Sub="{DynamicResource querySearchPrecisionToolTip}">
<ComboBox
MaxWidth="200"
DisplayMemberPath="Display"
@ -171,17 +174,9 @@
<cc:Card Title="{DynamicResource lastQueryMode}" Sub="{DynamicResource lastQueryModeToolTip}">
<ComboBox
DisplayMemberPath="Display"
SelectedValuePath="Value"
ItemsSource="{Binding LastQueryModes}"
SelectedValue="{Binding Settings.LastQueryMode}" />
</cc:Card>
<cc:Card Icon="&#xe8fd;" Title="{DynamicResource maxShowResults}"
Sub="{DynamicResource maxShowResultsToolTip}">
<ComboBox
Width="100"
ItemsSource="{Binding MaxResultsRange}"
SelectedItem="{Binding Settings.MaxResultsToShow}" />
SelectedValue="{Binding Settings.LastQueryMode}"
SelectedValuePath="Value" />
</cc:Card>
</cc:CardGroup>

View file

@ -24,109 +24,351 @@
</ResourceDictionary>
</ui:Page.Resources>
<ScrollViewer
Padding="6,0,24,0"
CanContentScroll="True"
Padding="6 0 24 0"
CanContentScroll="False"
FontSize="14"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.ScrollUnit="Pixel">
<StackPanel>
<!-- Page title -->
<TextBlock
Margin="5,23,0,5"
Margin="5 23 0 5"
FontSize="30"
Style="{StaticResource PageTitle}"
Text="{DynamicResource appearance}"
TextAlignment="left"
Visibility="Collapsed" />
<!-- Theme Preview and Editor -->
<Grid Height="380">
<Grid.Resources>
<!-- Style for the second ColumnDefinition -->
<Style x:Key="SecondColumnStyle" TargetType="ColumnDefinition">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Editor, Path=IsChecked}" Value="False">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=Editor, Path=IsChecked}" Value="True">
<Setter Property="Width" Value="2*" />
<Setter Property="MinWidth" Value="160" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*" />
<ColumnDefinition MaxWidth="250" Style="{StaticResource SecondColumnStyle}" />
</Grid.ColumnDefinitions>
<!-- Theme Size Editor -->
<Border
Grid.Column="1"
Padding="0 0 0 0"
Background="{DynamicResource Color00B}"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1"
CornerRadius="0 6 6 0">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Editor, Path=IsChecked}" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<ScrollViewer
ScrollViewer.CanContentScroll="False"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.ScrollUnit="Pixel">
<StackPanel>
<Slider
Name="WindowHeightValue"
Margin="12 8 12 8"
VerticalAlignment="Center"
ui:ControlHelper.Header="{DynamicResource SearchBarHeight}"
AutoToolTipPlacement="TopLeft"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="60"
Minimum="20"
TickFrequency="2"
Value="{Binding WindowHeightSize, Mode=TwoWay}" />
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Slider
Name="QueryBoxFontSize"
Margin="12 8 12 0"
VerticalAlignment="Center"
ui:ControlHelper.Header="{DynamicResource queryBoxFont}"
AutoToolTipPlacement="TopLeft"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="{Binding ElementName=WindowHeightValue, Path=Value, UpdateSourceTrigger=PropertyChanged}"
Minimum="10"
TickFrequency="1"
Value="{Binding QueryBoxFontSize, Mode=TwoWay}" />
<ComboBox
Name="QueryBoxFontComboBox"
Margin="12 4 12 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedQueryBoxFont}" />
<ComboBox
Name="QueryBoxFontStyleComboBox"
Margin="12 8 12 8"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ItemsSource="{Binding SelectedQueryBoxFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedQueryBoxFontFaces}">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Slider
Name="ItemHeightValue"
Margin="12 8 12 0"
VerticalAlignment="Stretch"
ui:ControlHelper.Header="{DynamicResource ItemHeight}"
AutoToolTipPlacement="TopLeft"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="100"
Minimum="30"
TickFrequency="2"
Value="{Binding ItemHeightSize, Mode=TwoWay}" />
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Slider
Name="ResultItemFontSize"
Margin="12 8 12 0"
VerticalAlignment="Center"
ui:ControlHelper.Header="{DynamicResource resultItemFont}"
AutoToolTipPlacement="TopLeft"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="80"
Minimum="10"
TickFrequency="1"
Value="{Binding ResultItemFontSize, Mode=TwoWay}" />
<ComboBox
Name="ResultItemFontComboBox"
Margin="12 4 12 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedResultFont}" />
<ComboBox
Name="ResultItemFontStyleComboBox"
Margin="12 4 12 8"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ItemsSource="{Binding SelectedResultFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedResultFontFaces}">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Slider
Name="ResultSubItemFontSize"
Margin="12 8 12 0"
VerticalAlignment="Center"
ui:ControlHelper.Header="{DynamicResource resultSubItemFont}"
AutoToolTipPlacement="TopLeft"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="80"
Minimum="6"
TickFrequency="1"
Value="{Binding ResultSubItemFontSize, Mode=TwoWay}" />
<ComboBox
Name="ResultSubItemFontComboBox"
Margin="12 4 12 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedResultSubFont}" />
<ComboBox
Name="ResultSubItemFontStyleComboBox"
Margin="12 4 12 8"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ItemsSource="{Binding SelectedResultSubFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedResultSubFontFaces}">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Button
Margin="8"
HorizontalAlignment="Stretch"
Click="Reset_Click"
Content="{DynamicResource resetCustomize}" />
<!-- Theme preview -->
<StackPanel
Height="350"
Margin="0"
Background="{Binding PreviewBackground}"
IsHitTestVisible="False">
<StackPanel
Margin="0,30,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border
Width="{Binding WindowWidthSize}"
Margin="0"
SnapsToDevicePixels="True"
Style="{DynamicResource WindowBorderStyle}"
UseLayoutRounding="True">
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- Query TextBox -->
<TextBox
x:Name="QueryTextBox"
Grid.Row="0"
IsReadOnly="True"
Style="{DynamicResource QueryBoxStyle}"
Text="{DynamicResource hiThere}" />
<!-- Clock panel -->
<StackPanel
Grid.Row="0"
Style="{DynamicResource ClockPanel}"
Visibility="Visible">
<!-- Clock TextBox -->
<TextBlock
x:Name="ClockBox"
Style="{DynamicResource ClockBox}"
Text="{Binding ClockText}"
Visibility="{Binding Settings.UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
<!-- Date TextBox -->
<TextBlock
x:Name="DateBox"
Style="{DynamicResource DateBox}"
Text="{Binding DateText}"
Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<Canvas Grid.Row="0" Style="{DynamicResource SearchIconPosition}">
<Path
Margin="0"
Data="{DynamicResource SearchIconImg}"
Stretch="Fill"
Style="{DynamicResource SearchIconStyle}" />
</Canvas>
</StackPanel>
</ScrollViewer>
</Border>
<!-- Theme Preview -->
<Border Grid.Column="0" Background="{Binding PreviewBackground}">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="6 0 0 6" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Editor, Path=IsChecked}" Value="False">
<Setter Property="CornerRadius" Value="6" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<DockPanel LastChildFill="True">
<StackPanel
Width="Auto"
Background="Transparent"
DockPanel.Dock="Right"
Orientation="Horizontal">
<ToggleButton
x:Name="Editor"
Width="36"
Height="36"
Margin="8"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Style="{DynamicResource CustomToggleButtonStyle}"
ToolTip="{DynamicResource CustomizeToolTip}">
<ui:FontIcon
FontSize="14"
Foreground="{DynamicResource Color05B}"
Glyph="&#xe70f;" />
</ToggleButton>
<Rectangle
Grid.Row="1"
Width="Auto"
HorizontalAlignment="Stretch"
Style="{DynamicResource SeparatorStyle}"
Visibility="Visible" />
</StackPanel>
<StackPanel VerticalAlignment="Center" DockPanel.Dock="Left">
<Border
Width="400"
Margin="40 30 0 30"
SnapsToDevicePixels="True"
Style="{DynamicResource WindowBorderStyle}"
UseLayoutRounding="True">
<Border Style="{DynamicResource WindowRadius}">
<Border.Clip>
<MultiBinding Converter="{StaticResource BorderClipConverter}">
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Border.Clip>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0">
<TextBox
x:Name="QueryTextBox"
Height="{Binding WindowHeightSize, Mode=TwoWay}"
FontSize="{Binding QueryBoxFontSize, Mode=TwoWay}"
IsHitTestVisible="False"
IsReadOnly="True"
Style="{DynamicResource QueryBoxStyle}"
Text="{DynamicResource hiThere}" />
<flowlauncher:ResultListBox
x:Name="ResultListBox"
Grid.Row="2"
DataContext="{Binding PreviewResults, Mode=OneTime}"
Visibility="Visible" />
<Border x:Name="ContextMenu" Visibility="Collapsed" />
<Border x:Name="History" Visibility="Collapsed" />
</Grid>
</Border>
</Border>
</StackPanel>
</StackPanel>
</Border>
<StackPanel
x:Name="ClockPanel"
IsHitTestVisible="False"
Style="{DynamicResource ClockPanel}"
Visibility="Visible">
<TextBlock
x:Name="ClockBox"
Style="{DynamicResource ClockBox}"
Text="{Binding ClockText}"
Visibility="{Binding UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBlock
x:Name="DateBox"
Style="{DynamicResource DateBox}"
Text="{Binding DateText}"
Visibility="{Binding UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<Canvas Style="{DynamicResource SearchIconPosition}">
<Path
Margin="0"
Data="{DynamicResource SearchIconImg}"
Stretch="Fill"
Style="{DynamicResource SearchIconStyle}" />
</Canvas>
<Border Grid.Row="1" Margin="0 0 0 0">
<Rectangle
Width="Auto"
HorizontalAlignment="Stretch"
Style="{DynamicResource SeparatorStyle}"
Visibility="Visible" />
</Border>
<ContentControl Grid.Row="2">
<flowlauncher:ResultListBox
x:Name="ResultListBox"
DataContext="{Binding PreviewResults, Mode=OneTime}"
IsHitTestVisible="False"
Visibility="Visible" />
</ContentControl>
<Border x:Name="ContextMenu" Visibility="Collapsed" />
<Border x:Name="History" Visibility="Collapsed" />
</Grid>
</Border>
</Border>
</StackPanel>
</DockPanel>
</Border>
</Grid>
<!-- Drop shadow effect -->
<cc:Card
Title="{DynamicResource queryWindowShadowEffect}"
Margin="0,4,0,0"
Margin="0 4 0 0"
Icon="&#xeb91;"
Sub="{DynamicResource shadowEffectCPUUsage}">
<ui:ToggleSwitch
@ -135,35 +377,10 @@
OnContent="{DynamicResource enable}" />
</cc:Card>
<!-- Window width size -->
<cc:Card
Title="{DynamicResource windowWidthSize}"
Icon="&#xe740;"
Sub="{DynamicResource windowWidthSizeToolTip}">
<StackPanel Orientation="Horizontal">
<TextBlock
Width="Auto"
Margin="0,0,8,2"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{Binding WindowWidthSize}"
TextAlignment="Right" />
<Slider
Width="250"
VerticalAlignment="Center"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="1920"
Minimum="400"
TickFrequency="10"
Value="{Binding WindowWidthSize}" />
</StackPanel>
</cc:Card>
<!-- Theme -->
<Border
Height="64"
Margin="0,8,0,0"
Margin="0 8 0 0"
CornerRadius="5 5 0 0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
@ -180,7 +397,7 @@
Margin="0"
Padding="0"
HorizontalAlignment="Stretch"
BorderThickness="1,0,1,1"
BorderThickness="1 0 1 1"
CornerRadius="0 0 5 5"
Style="{DynamicResource SettingGroupBox}">
<ListBox
@ -208,13 +425,13 @@
Padding="{TemplateBinding Padding}"
Background="{DynamicResource Color12B}"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1,1,1,0"
BorderThickness="1 1 1 0"
CornerRadius="4"
SnapsToDevicePixels="true">
<Border
x:Name="Bd2"
BorderBrush="{DynamicResource Color14B}"
BorderThickness="0,0,0,2"
BorderThickness="0 0 0 2"
CornerRadius="4">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
@ -252,7 +469,7 @@
<TextBlock
x:Name="ThemeName"
Margin="0"
Padding="14,12"
Padding="14 12"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="True"
@ -277,76 +494,38 @@
Text="{DynamicResource browserMoreThemes}"
Uri="{Binding LinkThemeGallery}" />
<!-- Fonts and icons -->
<cc:CardGroup Margin="0,30,0,0">
<cc:CardGroup Margin="0 20 0 0">
<cc:Card
Title="{DynamicResource useGlyphUI}"
Icon="&#xf6b8;"
Sub="{DynamicResource useGlyphUIEffect}">
<ui:ToggleSwitch
IsOn="{Binding UseGlyphIcons}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
Title="{DynamicResource KeepMaxResults}"
Icon="&#xe8fd;"
Sub="{DynamicResource KeepMaxResultsToolTip}">
<ui:ToggleSwitch IsOn="{Binding KeepMaxResults}" />
</cc:Card>
<cc:Card Title="{DynamicResource queryBoxFont}" Icon="&#xe990;">
<StackPanel Orientation="Horizontal">
<ComboBox
Width="180"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedQueryBoxFont}" />
<ComboBox
Width="130"
Margin="10,0,0,0"
ItemsSource="{Binding SelectedQueryBoxFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedQueryBoxFontFaces}">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</cc:Card>
<cc:Card Title="{DynamicResource resultItemFont}" Icon="&#xe8fd;">
<StackPanel Orientation="Horizontal">
<ComboBox
Width="180"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedResultFont}" />
<ComboBox
Width="130"
Margin="10,0,0,0"
ItemsSource="{Binding SelectedResultFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedResultFontFaces}">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<cc:Card
Title="{DynamicResource maxShowResults}"
Sub="{DynamicResource maxShowResultsToolTip}"
Visibility="{Binding KeepMaxResults, Converter={StaticResource BoolToVisibilityConverter}}">
<ComboBox
Width="100"
ItemsSource="{Binding MaxResultsRange}"
SelectedItem="{Binding Settings.MaxResultsToShow}" />
</cc:Card>
</cc:CardGroup>
<!-- Fonts and icons -->
<cc:Card
Title="{DynamicResource useGlyphUI}"
Margin="0 6 0 0"
Icon="&#xf6b8;"
Sub="{DynamicResource useGlyphUIEffect}">
<ui:ToggleSwitch
IsOn="{Binding UseGlyphIcons}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>
<!-- Time and date -->
<cc:CardGroup Margin="0,24,0,0">
<cc:CardGroup Margin="0 11 0 0">
<cc:Card Title="{DynamicResource Clock}" Icon="&#xec92;">
<StackPanel Orientation="Horizontal">
<TextBlock
@ -356,7 +535,7 @@
Text="{Binding ClockText}" />
<ComboBox
MinWidth="180"
Margin="10,0,18,0"
Margin="10 0 18 0"
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding TimeFormatList}"
@ -377,7 +556,7 @@
Text="{Binding DateText}" />
<ComboBox
MinWidth="180"
Margin="10,0,18,0"
Margin="10 0 18 0"
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding DateFormatList}"
@ -391,7 +570,7 @@
</cc:CardGroup>
<!-- Animation -->
<cc:CardGroup Margin="0,11,0,0">
<cc:CardGroup Margin="0 11 0 0">
<cc:Card
Title="{DynamicResource Animation}"
Icon="&#xedb5;"
@ -418,7 +597,7 @@
<TextBox
MinWidth="80"
Margin="18,0,0,0"
Margin="18 0 0 0"
Text="{Binding Settings.CustomAnimationLength}"
TextWrapping="NoWrap"
Visibility="{ext:VisibleWhen {Binding Settings.AnimationSpeed},
@ -428,7 +607,7 @@
</cc:CardGroup>
<!-- SFX -->
<cc:CardGroup Margin="0,11,0,0">
<cc:CardGroup Margin="0 11 0 0">
<cc:Card
Title="{DynamicResource SoundEffect}"
Icon="&#xe7f5;"
@ -446,7 +625,7 @@
Visibility="{Binding UseSound, Converter={StaticResource BoolToVisibilityConverter}}">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,8,0"
Margin="0 0 8 0"
VerticalAlignment="Center"
Text="{Binding SoundEffectVolume}" />
<Slider
@ -463,12 +642,12 @@
</cc:CardGroup>
<Border
Name="WMPWarning"
Padding="0,10"
Padding="0 10"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Background="{DynamicResource InfoBarWarningBG}"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="0,1,0,0"
BorderThickness="0 1 0 0"
CornerRadius="5 5 5 5"
Visibility="{Binding ShowWMPWarning, Converter={StaticResource BoolToVisibilityConverter}}">
<Grid VerticalAlignment="Center">
@ -478,15 +657,15 @@
</Grid.ColumnDefinitions>
<ui:FontIcon
Grid.Column="0"
Margin="20,0,14,0"
Margin="20 0 14 0"
VerticalAlignment="Center"
FontSize="15"
Foreground="{DynamicResource InfoBarWarningIcon}"
Glyph="&#xf167;" />
<TextBlock
Grid.Column="1"
Margin="0,0,0,2"
Padding="0,0,8,0"
Margin="0 0 0 2"
Padding="0 0 8 0"
HorizontalAlignment="Left"
FontSize="13"
FontWeight="SemiBold"
@ -499,7 +678,7 @@
<!-- Settings color scheme -->
<cc:Card
Title="{DynamicResource ColorScheme}"
Margin="0,11,0,0"
Margin="0 11 0 0"
Icon="&#xe793;">
<ComboBox
MinWidth="180"
@ -521,7 +700,7 @@
<!-- How to create theme link -->
<cc:HyperLink
Margin="10,10,10,28"
Margin="10 10 10 28"
HorizontalAlignment="Right"
Text="{DynamicResource howToCreateTheme}"
Uri="{Binding LinkHowToCreateTheme}" />

View file

@ -1,5 +1,7 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Navigation;
using Flow.Launcher.SettingPages.ViewModels;
using Page = ModernWpf.Controls.Page;
@ -28,4 +30,52 @@ public partial class SettingsPaneTheme : Page
{
_viewModel.UpdateColorScheme();
}
private void Reset_Click(object sender, RoutedEventArgs e)
{
/*The FamilyTypeface should initialize all of its various properties.*/
FamilyTypeface targetTypeface = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
QueryBoxFontSize.Value = 20;
QueryBoxFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", QueryBoxFontComboBox);
QueryBoxFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, QueryBoxFontStyleComboBox);
ResultItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultItemFontComboBox);
ResultItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultItemFontStyleComboBox);
ResultItemFontSize.Value = 16;
ResultSubItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultSubItemFontComboBox);
ResultSubItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultSubItemFontStyleComboBox);
ResultSubItemFontSize.Value = 13;
WindowHeightValue.Value = 42;
ItemHeightValue.Value = 58;
}
private int SearchFontIndex(string targetFont, ComboBox combo)
{
for (int i = 0; i < combo.Items.Count; i++)
{
if (combo.Items[i]?.ToString() == targetFont)
{
return i;
}
}
return 0;
}
private int SearchFontStyleIndex(FamilyTypeface targetTypeface, ComboBox combo)
{
for (int i = 0; i < combo.Items.Count; i++)
{
if (combo.Items[i] is FamilyTypeface typefaceItem &&
typefaceItem.Stretch == targetTypeface.Stretch &&
typefaceItem.Weight == targetTypeface.Weight &&
typefaceItem.Style == targetTypeface.Style)
{
return i;
}
}
return 0;
}
}

View file

@ -19,8 +19,6 @@ using Microsoft.VisualStudio.Threading;
using System.Text;
using System.Threading.Channels;
using ISavable = Flow.Launcher.Plugin.ISavable;
using System.IO;
using System.Collections.Specialized;
using CommunityToolkit.Mvvm.Input;
using System.Globalization;
using System.Windows.Input;
@ -72,6 +70,21 @@ namespace Flow.Launcher.ViewModel
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;
@ -439,7 +452,7 @@ namespace Flow.Launcher.ViewModel
{
SelectedResults.SelectPrevResult();
}
}
[RelayCommand]
@ -466,7 +479,7 @@ namespace Flow.Launcher.ViewModel
{
GameModeStatus = !GameModeStatus;
}
[RelayCommand]
public void CopyAlternative()
{
@ -523,16 +536,8 @@ namespace Flow.Launcher.ViewModel
[RelayCommand]
private void IncreaseWidth()
{
if (MainWindowWidth + 100 > 1920 || Settings.WindowSize == 1920)
{
Settings.WindowSize = 1920;
}
else
{
Settings.WindowSize += 100;
Settings.WindowLeft -= 50;
}
Settings.WindowSize += 100;
Settings.WindowLeft -= 50;
OnPropertyChanged();
}
@ -704,6 +709,36 @@ namespace Flow.Launcher.ViewModel
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 string PluginIconPath { get; set; } = null;
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
@ -722,7 +757,7 @@ namespace Flow.Launcher.ViewModel
return hotkey;
}
public string PreviewHotkey => VerifyOrSetDefaultHotkey(Settings.PreviewHotkey, "F1");
public string AutoCompleteHotkey => VerifyOrSetDefaultHotkey(Settings.AutoCompleteHotkey, "Ctrl+Tab");
public string AutoCompleteHotkey2 => VerifyOrSetDefaultHotkey(Settings.AutoCompleteHotkey2, "");

View file

@ -29,7 +29,7 @@ namespace Flow.Launcher.ViewModel
if (Result.Glyph is { FontFamily: not null } glyph)
{
// Checks if it's a system installed font, which does not require path to be provided.
// Checks if it's a system installed font, which does not require path to be provided.
if (glyph.FontFamily.EndsWith(".ttf") || glyph.FontFamily.EndsWith(".otf"))
{
string fontFamilyPath = glyph.FontFamily;
@ -64,7 +64,7 @@ namespace Flow.Launcher.ViewModel
}
private Settings Settings { get; }
public Settings Settings { get; }
public Visibility ShowOpenResultHotkey =>
Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Collapsed;

View file

@ -32,9 +32,15 @@ namespace Flow.Launcher.ViewModel
_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,14 +49,19 @@ namespace Flow.Launcher.ViewModel
#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; }
public Thickness Margin { get; set; }
public Visibility Visibility { get; set; } = Visibility.Collapsed;
public ICommand RightClickResultCommand { get; init; }
public ICommand LeftClickResultCommand { get; init; }