[PTRun]Add setting to disable input delay (#18724)

* [PTRun]Add setting to disable input delay

* Address feedback and allow configuring delay

* Address PR feedback
This commit is contained in:
Jaime Bernardo
2022-06-12 14:12:10 +01:00
committed by GitHub
parent b33bc2ecd0
commit 1490fb300c
8 changed files with 185 additions and 7 deletions

View File

@@ -51,6 +51,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("use_centralized_keyboard_hook")]
public bool UseCentralizedKeyboardHook { get; set; }
[JsonPropertyName("search_query_results_with_delay")]
public bool SearchQueryResultsWithDelay { get; set; }
[JsonPropertyName("search_input_delay")]
public int SearchInputDelay { get; set; }
public PowerLauncherProperties()
{
OpenPowerLauncher = new HotkeySettings(false, false, true, false, 32);
@@ -65,6 +71,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Theme = Theme.System;
Position = StartupPosition.Cursor;
UseCentralizedKeyboardHook = false;
SearchQueryResultsWithDelay = true;
SearchInputDelay = 150;
}
}
}

View File

@@ -296,6 +296,40 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool SearchQueryResultsWithDelay
{
get
{
return settings.Properties.SearchQueryResultsWithDelay;
}
set
{
if (settings.Properties.SearchQueryResultsWithDelay != value)
{
settings.Properties.SearchQueryResultsWithDelay = value;
UpdateSettings();
}
}
}
public int SearchInputDelay
{
get
{
return settings.Properties.SearchInputDelay;
}
set
{
if (settings.Properties.SearchInputDelay != value)
{
settings.Properties.SearchInputDelay = value;
UpdateSettings();
}
}
}
public HotkeySettings OpenFileLocation
{
get

View File

@@ -414,6 +414,17 @@
<data name="PowerLauncher_ClearInputOnLaunch.Content" xml:space="preserve">
<value>Clear the previous query on launch</value>
</data>
<data name="PowerLauncher_SearchQueryResultsWithDelay.Header" xml:space="preserve">
<value>Delay search</value>
<comment>This is about adding a delay to wait for more input before executing a search</comment>
</data>
<data name="PowerLauncher_SearchQueryResultsWithDelay.Description" xml:space="preserve">
<value>Add a delay to wait for more input before executing a search</value>
</data>
<data name="PowerLauncher_SearchInputDelayMs.Header" xml:space="preserve">
<value>Search delay (ms)</value>
<comment>ms = milliseconds</comment>
</data>
<data name="KeyboardManager_KeysMappingLayoutRightHeader.Text" xml:space="preserve">
<value>To:</value>
<comment>Keyboard Manager mapping keys view right header</comment>

View File

@@ -94,6 +94,29 @@
<controls:SettingsGroup x:Uid="PowerLauncher_SearchResults" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}">
<controls:SettingExpander IsExpanded="True">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="PowerLauncher_SearchQueryResultsWithDelay" Icon="&#xF182;" Style="{StaticResource ExpanderHeaderSettingStyle}" >
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.SearchQueryResultsWithDelay}"/>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<controls:Setting x:Uid="PowerLauncher_SearchInputDelayMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.SearchQueryResultsWithDelay}" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox Minimum="0"
Maximum="1000"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.SearchInputDelay}"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
SmallChange="10"
LargeChange="50"/>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:SettingExpander.Content>
</controls:SettingExpander>
<controls:SettingExpander IsExpanded="True">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="PowerLauncher_MaximumNumberOfResults" Icon="&#xE721;" Style="{StaticResource ExpanderHeaderSettingStyle}">