[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>
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 15 KiB |
@ -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}"
|
||||
|
@ -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;
|
||||
|
@ -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}"
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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}">
|
||||
|
@ -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;
|
||||
|
@ -341,6 +341,8 @@ namespace Wox.Infrastructure.UserSettings
|
||||
}
|
||||
}
|
||||
|
||||
public int TitleFontSize { get; set; } = 16;
|
||||
|
||||
public bool IgnoreHotkeysOnFullscreen { get; set; }
|
||||
|
||||
public bool StartedFromPowerToysRunner { get; set; }
|
||||
|
@ -51,6 +51,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("show_plugins_overview")]
|
||||
public int ShowPluginsOverview { get; set; }
|
||||
|
||||
[JsonPropertyName("title_fontsize")]
|
||||
public int TitleFontSize { get; set; }
|
||||
|
||||
[JsonPropertyName("startupPosition")]
|
||||
public StartupPosition Position { get; set; }
|
||||
|
||||
@ -111,6 +114,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
GenerateThumbnailsFromFiles = true;
|
||||
UsePinyin = false;
|
||||
ShowPluginsOverview = 0;
|
||||
TitleFontSize = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ namespace ViewModelTests
|
||||
Assert.AreEqual(originalSettings.Properties.GenerateThumbnailsFromFiles, viewModel.GenerateThumbnailsFromFiles);
|
||||
Assert.AreEqual(originalSettings.Properties.UsePinyin, viewModel.UsePinyin);
|
||||
Assert.AreEqual(originalSettings.Properties.ShowPluginsOverview, viewModel.ShowPluginsOverviewIndex);
|
||||
Assert.AreEqual(originalSettings.Properties.TitleFontSize, viewModel.TitleFontSize);
|
||||
|
||||
// Verify that the stub file was used
|
||||
var expectedCallCount = 2; // once via the view model, and once by the test (GetSettings<T>)
|
||||
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 34 KiB |
@ -209,6 +209,33 @@
|
||||
<ComboBoxItem x:Uid="ShowPluginsOverview_None" />
|
||||
</ComboBox>
|
||||
</controls:SettingsCard>
|
||||
|
||||
<controls:SettingsCard x:Uid="PowerLauncher_TitleFontSize" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="12"
|
||||
FontWeight="SemiBold"
|
||||
Text="A" />
|
||||
<Slider
|
||||
x:Uid="PowerLauncher_TextFontSizeSlider"
|
||||
LargeChange="2"
|
||||
Maximum="24"
|
||||
Minimum="12"
|
||||
SmallChange="2"
|
||||
StepFrequency="2"
|
||||
TickFrequency="2"
|
||||
TickPlacement="Outside"
|
||||
Value="{x:Bind ViewModel.TitleFontSize, Mode=TwoWay}" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="24"
|
||||
FontWeight="SemiBold"
|
||||
Text="A" />
|
||||
</StackPanel>
|
||||
</controls:SettingsCard>
|
||||
</custom:SettingsGroup>
|
||||
|
||||
<custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}">
|
||||
|
@ -59,10 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root"
|
||||
xmlns=""
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
@ -3916,4 +3913,13 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="ShowPluginsOverview_NonGlobal.Content" xml:space="preserve">
|
||||
<value>Not included in global results</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_TitleFontSize.Description" xml:space="preserve">
|
||||
<value>The size of result titles and the search query</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_TitleFontSize.Header" xml:space="preserve">
|
||||
<value>Text size (pt)</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Text size of result titles</value>
|
||||
</data>
|
||||
</root>
|
@ -614,6 +614,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int TitleFontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.Properties.TitleFontSize;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.Properties.TitleFontSize != value)
|
||||
{
|
||||
settings.Properties.TitleFontSize = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<PowerLauncherPluginViewModel> _plugins;
|
||||
|
||||
public ObservableCollection<PowerLauncherPluginViewModel> Plugins
|
||||
|