[Run] Adding configurable fontsizes (#30541)

* Adding configurable fontsize for result titles

* Update src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>

* Updating strings

* XAML styler

* CI fix

* PowerLauncher images

* update results height on font change

* Revert "update results height on font change"

This reverts commit 459f57c647.

---------

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
This commit is contained in:
Niels Laute
2023-12-26 14:49:50 +01:00
committed by GitHub
parent c098cfb193
commit ccd401fc16
16 changed files with 115 additions and 40 deletions

View File

@@ -33,7 +33,7 @@
<TextBlock
Margin="6,0,0,0"
VerticalAlignment="Center"
FontSize="16"
FontSize="{DynamicResource TitleFontSize}"
Text="{TemplateBinding Tag}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
@@ -98,11 +98,13 @@
<local:CustomSearchBox
x:Name="QueryTextBox"
Grid.Column="1"
MinHeight="0"
Margin="0"
VerticalAlignment="Center"
x:FieldModifier="public"
AutomationProperties.Name="{x:Static p:Resources.Query}"
Canvas.ZIndex="0"
FontSize="18"
FontSize="{DynamicResource TitleFontSize}"
Style="{StaticResource QueryTextBoxStyle}"
Tag="{x:Static p:Resources.startTyping}" />
<TextBlock
@@ -112,7 +114,7 @@
VerticalAlignment="Center"
x:FieldModifier="public"
Canvas.ZIndex="-1"
FontSize="18"
FontSize="{DynamicResource TitleFontSize}"
Foreground="{DynamicResource TextPlaceholderColorBrush}" />
<ui:SymbolIcon
AutomationProperties.Name="{x:Static p:Resources.SearchIcon}"

View File

@@ -214,6 +214,7 @@ namespace PowerLauncher
_viewModel.MainWindowVisibility = Visibility.Collapsed;
_viewModel.LoadedAtLeastOnce = true;
_viewModel.SetPluginsOverviewVisibility();
_viewModel.SetFontSize();
BringProcessToForeground();
}
@@ -357,6 +358,8 @@ namespace PowerLauncher
BringProcessToForeground();
_viewModel.SetPluginsOverviewVisibility();
_viewModel.SetFontSize();
if (_viewModel.Plugins.Count > 0)
{
_viewModel.SelectedPlugin = null;

View File

@@ -5,7 +5,6 @@
xmlns:Behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:converters="clr-namespace:PowerLauncher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helper="clr-namespace:PowerLauncher.Helper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:p="clr-namespace:PowerLauncher.Properties"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
@@ -59,7 +58,7 @@
<ListView.ItemTemplate>
<DataTemplate>
<Grid
Height="44"
MinHeight="44"
Background="Transparent"
ToolTipService.BetweenShowDelay="0"
ToolTipService.InitialShowDelay="1000">
@@ -76,10 +75,6 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ToolTip>
<ToolTip
MaxWidth="480"
@@ -109,35 +104,38 @@
VerticalAlignment="Center"
AutomationProperties.Name="{x:Static p:Resources.AppIcon}"
Source="{Binding Image}" />
<TextBlock
x:Name="Title"
<StackPanel
Grid.Column="1"
VerticalAlignment="Bottom"
AutomationProperties.Name="{x:Static p:Resources.Title}"
FontSize="16"
IsHitTestVisible="False"
TextTrimming="CharacterEllipsis">
<viewmodel:ResultsViewModel.FormattedText>
<MultiBinding Converter="{StaticResource highlightTextConverter}">
<Binding Path="Result.Title" />
<Binding Path="Result.TitleHighlightData" />
<Binding Path="IsSelected" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type ListViewItem}}" />
</MultiBinding>
</viewmodel:ResultsViewModel.FormattedText>
</TextBlock>
<TextBlock
x:Name="Path"
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Top"
AutomationProperties.Name="{x:Static p:Resources.Subtitle}"
Opacity="0.6"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Result.SubTitle}"
TextTrimming="CharacterEllipsis" />
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock
x:Name="Title"
VerticalAlignment="Bottom"
AutomationProperties.Name="{x:Static p:Resources.Title}"
FontSize="{DynamicResource TitleFontSize}"
IsHitTestVisible="False"
TextTrimming="CharacterEllipsis">
<viewmodel:ResultsViewModel.FormattedText>
<MultiBinding Converter="{StaticResource highlightTextConverter}">
<Binding Path="Result.Title" />
<Binding Path="Result.TitleHighlightData" />
<Binding Path="IsSelected" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type ListViewItem}}" />
</MultiBinding>
</viewmodel:ResultsViewModel.FormattedText>
</TextBlock>
<TextBlock
x:Name="Path"
VerticalAlignment="Top"
AutomationProperties.Name="{x:Static p:Resources.Subtitle}"
Opacity="0.6"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Result.SubTitle}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
<ListView
Grid.RowSpan="2"
Grid.Column="2"
Height="44"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemsCollection}"

View File

@@ -180,6 +180,11 @@ namespace PowerLauncher
_settings.ShowPluginsOverview = (PowerToysRunSettings.ShowPluginsOverviewMode)overloadSettings.Properties.ShowPluginsOverview;
}
if (_settings.TitleFontSize != overloadSettings.Properties.TitleFontSize)
{
_settings.TitleFontSize = overloadSettings.Properties.TitleFontSize;
}
retry = false;
}

View File

@@ -1,4 +1,9 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespace:System;assembly=mscorlib">
<core:Double x:Key="TitleFontSize">16</core:Double>
<!-- This removes the selection state of the default WpfUI ListViewItemStyle -->
<Style x:Key="PluginsListViewItemStyle" TargetType="{x:Type ListViewItem}">

View File

@@ -397,6 +397,11 @@ namespace PowerLauncher.ViewModel
}
}
public void SetFontSize()
{
App.Current.Resources["TitleFontSize"] = (double)_settings.TitleFontSize;
}
public bool LastQuerySelected { get; set; }
private ResultsViewModel _selectedResults;

View File

@@ -341,6 +341,8 @@ namespace Wox.Infrastructure.UserSettings
}
}
public int TitleFontSize { get; set; } = 16;
public bool IgnoreHotkeysOnFullscreen { get; set; }
public bool StartedFromPowerToysRunner { get; set; }