mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[PTRun]Settings for result order tuning (#18978)
* Change to allow new settings for results tuning. * Change to allow new settings for results tuning. * Added WeightBoost * Fixed null-ref crash in QueryResults * Change based on stefansjfw review. Remove PowerLauncher_PluginWeightBoost.Content * Fixed another of my dumb null-refs... * Updated some text * Moved global sort order and set enable/disabled as needed. * Fixed enabled-state of "Global sort order score modifier" setting.
This commit is contained in:
@@ -22,6 +22,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
|
||||
public string ActionKeyword { get; set; }
|
||||
|
||||
public int WeightBoost { get; set; }
|
||||
|
||||
public string IconPathDark { get; set; }
|
||||
|
||||
public string IconPathLight { get; set; }
|
||||
|
||||
@@ -57,6 +57,15 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("search_input_delay")]
|
||||
public int SearchInputDelay { get; set; }
|
||||
|
||||
[JsonPropertyName("search_clicked_item_weight")]
|
||||
public int SearchClickedItemWeight { get; set; }
|
||||
|
||||
[JsonPropertyName("search_query_tuning_enabled")]
|
||||
public bool SearchQueryTuningEnabled { get; set; }
|
||||
|
||||
[JsonPropertyName("search_wait_for_slow_results")]
|
||||
public bool SearchWaitForSlowResults { get; set; }
|
||||
|
||||
public PowerLauncherProperties()
|
||||
{
|
||||
OpenPowerLauncher = new HotkeySettings(false, false, true, false, 32);
|
||||
@@ -73,6 +82,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
UseCentralizedKeyboardHook = false;
|
||||
SearchQueryResultsWithDelay = true;
|
||||
SearchInputDelay = 150;
|
||||
SearchClickedItemWeight = 5;
|
||||
SearchQueryTuningEnabled = false;
|
||||
SearchWaitForSlowResults = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,25 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int WeightBoost
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.WeightBoost;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.WeightBoost != value)
|
||||
{
|
||||
settings.WeightBoost = value;
|
||||
NotifyPropertyChanged();
|
||||
NotifyPropertyChanged(nameof(ShowNotAccessibleWarning));
|
||||
NotifyPropertyChanged(nameof(ShowNotAllowedKeywordWarning));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ActionKeyword
|
||||
{
|
||||
get
|
||||
|
||||
@@ -330,6 +330,57 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool SearchQueryTuningEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.Properties.SearchQueryTuningEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.Properties.SearchQueryTuningEnabled != value)
|
||||
{
|
||||
settings.Properties.SearchQueryTuningEnabled = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool SearchWaitForSlowResults
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.Properties.SearchWaitForSlowResults;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.Properties.SearchWaitForSlowResults != value)
|
||||
{
|
||||
settings.Properties.SearchWaitForSlowResults = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int SearchClickedItemWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.Properties.SearchClickedItemWeight;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.Properties.SearchClickedItemWeight != value)
|
||||
{
|
||||
settings.Properties.SearchClickedItemWeight = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings OpenFileLocation
|
||||
{
|
||||
get
|
||||
|
||||
@@ -2125,6 +2125,30 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Content" xml:space="preserve">
|
||||
<value>Disable round corners when window is snapped</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchQueryTuningEnabled.Description" xml:space="preserve">
|
||||
<value>Fine tune results ordering</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchQueryTuningEnabled.Header" xml:space="preserve">
|
||||
<value>Results order tuning</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchClickedItemWeight.Description" xml:space="preserve">
|
||||
<value>Use a higher number to get selected results to rise faster. The default is 5, 0 to disable.</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchClickedItemWeight.Header" xml:space="preserve">
|
||||
<value>Selected item weight</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_WaitForSlowResults.Description" xml:space="preserve">
|
||||
<value>Selecting this can help preselect the top, more relevent result, but at the risk of jumpiness</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_WaitForSlowResults.Header" xml:space="preserve">
|
||||
<value>Wait on slower plugin results before selecting top item in results</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_PluginWeightBoost.Description" xml:space="preserve">
|
||||
<value>Use a higher number to have this plugin's result show higher in the global results. Default is 0.</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_PluginWeightBoost.Header" xml:space="preserve">
|
||||
<value>Global sort order score modifier</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_RoundCorners.Content" xml:space="preserve">
|
||||
<value>Enable round corners</value>
|
||||
</data>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<!-- Thickness -->
|
||||
<Thickness x:Key="ExpanderContentPadding">0</Thickness>
|
||||
<Thickness x:Key="ExpanderSettingMargin">56, 8, 40, 8</Thickness>
|
||||
<Thickness x:Key="ExpanderSettingMarginTight">86, 0, 40, 8</Thickness>
|
||||
|
||||
<SolidColorBrush x:Key="ExpanderChevronPointerOverBackground">Transparent</SolidColorBrush>
|
||||
|
||||
@@ -33,6 +34,16 @@
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ExpanderContentSettingStyleTight" TargetType="controls:Setting">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,0" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource CardBorderBrush}" />
|
||||
<Setter Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Padding" Value="{StaticResource ExpanderSettingMarginTight}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- Setting expander style -->
|
||||
<Style x:Key="SettingExpanderStyle" TargetType="muxc:Expander">
|
||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundBrush}" />
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
mc:Ignorable="d"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
|
||||
<Page.Resources>
|
||||
<converters:BoolToObjectConverter x:Key="BoolToVisibilityConverter" TrueValue="Visible" FalseValue="Collapsed"/>
|
||||
<converters:BoolNegationConverter x:Key="BoolNegationConverter"/>
|
||||
@@ -132,6 +132,49 @@
|
||||
<CheckBox x:Uid="PowerLauncher_ClearInputOnLaunch" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}" Margin="{StaticResource ExpanderSettingMargin}" />
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
|
||||
<controls:SettingExpander IsExpanded="True">
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting x:Uid="PowerLauncher_SearchQueryTuningEnabled" Icon="" Style="{StaticResource ExpanderHeaderSettingStyle}" >
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryTuningEnabled}"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingExpander.Header>
|
||||
<controls:SettingExpander.Content>
|
||||
<StackPanel>
|
||||
<controls:Setting x:Uid="PowerLauncher_SearchClickedItemWeight" Style="{StaticResource ExpanderContentSettingStyle}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}">
|
||||
<controls:Setting.ActionContent>
|
||||
<muxc:NumberBox Minimum="0"
|
||||
Maximum="1000"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchClickedItemWeight}"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
SmallChange="5"
|
||||
LargeChange="50"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<!--<controls:Setting x:Uid="PowerLauncher_WaitForSlowResults" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<CheckBox
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}"
|
||||
Margin="{StaticResource ExpanderSettingMargin}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>-->
|
||||
|
||||
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
|
||||
<controls:CheckBoxWithDescriptionControl
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryTuningEnabled}"
|
||||
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SearchWaitForSlowResults}"
|
||||
Margin="56, -2, 40, 14"
|
||||
x:Uid="PowerLauncher_WaitForSlowResults"/>
|
||||
|
||||
</StackPanel>
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference"
|
||||
@@ -246,6 +289,7 @@
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<muxc:InfoBar Severity="Error" x:Uid="Run_NotAccessibleWarning"
|
||||
IsTabStop="{x:Bind ShowNotAccessibleWarning}"
|
||||
IsOpen="{x:Bind ShowNotAccessibleWarning}"
|
||||
@@ -256,19 +300,34 @@
|
||||
IsOpen="{x:Bind ShowNotAllowedKeywordWarning}"
|
||||
IsClosable="False" />
|
||||
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
|
||||
<CheckBox AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}"
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<CheckBox AutomationProperties.Name="{Binding ElementName=IncludeInGlobalResultTitle, Path=Text}"
|
||||
IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind Enabled, Mode=OneWay}"
|
||||
Margin="56, 0, 40, 16">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock x:Name="IncludeInGlobalResultTitle"
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock x:Name="IncludeInGlobalResultTitle"
|
||||
Margin="0,10,0,0"
|
||||
x:Uid="PowerLauncher_IncludeInGlobalResultTitle" />
|
||||
<controls:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription"
|
||||
<controls:IsEnabledTextBlock x:Uid="PowerLauncher_IncludeInGlobalResultDescription"
|
||||
FontSize="{StaticResource SecondaryTextFontSize}"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||
</StackPanel>
|
||||
</CheckBox>
|
||||
|
||||
</StackPanel>
|
||||
</CheckBox>
|
||||
|
||||
<controls:Setting x:Uid="PowerLauncher_PluginWeightBoost"
|
||||
Style="{StaticResource ExpanderContentSettingStyleTight}"
|
||||
IsEnabled="{x:Bind Enabled, Mode=OneWay}">
|
||||
<controls:Setting.ActionContent>
|
||||
<TextBox Text="{x:Bind Path=WeightBoost, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<ListView ItemsSource="{x:Bind Path=AdditionalOptions}"
|
||||
SelectionMode="None"
|
||||
|
||||
Reference in New Issue
Block a user