Skip to content

Commit be6a063

Browse files
committed
Remove search delay
1 parent a3fa7a2 commit be6a063

File tree

11 files changed

+8
-176
lines changed

11 files changed

+8
-176
lines changed

Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public void UpdatePluginSettings(List<PluginMetadata> metadatas)
2929
settings.Version = metadata.Version;
3030
}
3131
settings.DefaultActionKeywords = metadata.ActionKeywords; // metadata provides default values
32-
settings.DefaultSearchDelayTime = metadata.SearchDelayTime; // metadata provides default values
3332

3433
// update metadata values with settings
3534
if (settings.ActionKeywords?.Count > 0)
@@ -44,7 +43,6 @@ public void UpdatePluginSettings(List<PluginMetadata> metadatas)
4443
}
4544
metadata.Disabled = settings.Disabled;
4645
metadata.Priority = settings.Priority;
47-
metadata.SearchDelayTime = settings.SearchDelayTime;
4846
metadata.HomeDisabled = settings.HomeDisabled;
4947
}
5048
else
@@ -59,9 +57,7 @@ public void UpdatePluginSettings(List<PluginMetadata> metadatas)
5957
ActionKeywords = metadata.ActionKeywords, // use default value
6058
Disabled = metadata.Disabled,
6159
HomeDisabled = metadata.HomeDisabled,
62-
Priority = metadata.Priority,
63-
DefaultSearchDelayTime = metadata.SearchDelayTime, // metadata provides default values
64-
SearchDelayTime = metadata.SearchDelayTime, // use default value
60+
Priority = metadata.Priority
6561
};
6662
}
6763
}
@@ -99,11 +95,6 @@ public class Plugin
9995

10096
public int Priority { get; set; }
10197

102-
[JsonIgnore]
103-
public int? DefaultSearchDelayTime { get; set; }
104-
105-
public int? SearchDelayTime { get; set; }
106-
10798
/// <summary>
10899
/// Used only to save the state of the plugin in settings
109100
/// </summary>

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,6 @@ public bool ShowAtTopmost
340340
}
341341
}
342342

343-
public bool SearchQueryResultsWithDelay { get; set; }
344-
public int SearchDelayTime { get; set; } = 150;
345343

346344
[JsonConverter(typeof(JsonStringEnumConverter))]
347345
public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor;

Flow.Launcher.Plugin/PluginMetadata.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,10 @@ internal set
103103
/// </summary>
104104
public bool HideActionKeywordPanel { get; set; }
105105

106-
/// <summary>
107-
/// Plugin search delay time in ms. Null means use default search delay time.
108-
/// </summary>
109-
public int? SearchDelayTime { get; set; } = null;
110-
111106
/// <summary>
112107
/// Plugin icon path.
113108
/// </summary>
114-
public string IcoPath { get; set;}
109+
public string IcoPath { get; set; }
115110

116111
/// <summary>
117112
/// Plugin priority.

Flow.Launcher/Languages/en.xaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@
105105
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
106106
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
107107
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
108-
<system:String x:Key="searchDelay">Search Delay</system:String>
109-
<system:String x:Key="searchDelayToolTip">Adds a short delay while typing to reduce UI flicker and result load. Recommended if your typing speed is average.</system:String>
110-
<system:String x:Key="searchDelayNumberBoxToolTip">Enter the wait time (in ms) until input is considered complete. This can only be edited if Search Delay is enabled.</system:String>
111-
<system:String x:Key="searchDelayTime">Default Search Delay Time</system:String>
112-
<system:String x:Key="searchDelayTimeToolTip">Wait time before showing results after typing stops. Higher values wait longer. (ms)</system:String>
113108
<system:String x:Key="homePage">Home Page</system:String>
114109
<system:String x:Key="homePageToolTip">Show home page results when query text is empty.</system:String>
115110
<system:String x:Key="homeToggleBoxToolTip">This can only be edited if plugin supports Home feature and Home Page is enabled.</system:String>
@@ -131,12 +126,9 @@
131126
<system:String x:Key="currentActionKeywords">Current action keyword</system:String>
132127
<system:String x:Key="newActionKeyword">New action keyword</system:String>
133128
<system:String x:Key="actionKeywordsTooltip">Change Action Keywords</system:String>
134-
<system:String x:Key="pluginSearchDelayTime">Plugin search delay time</system:String>
135-
<system:String x:Key="pluginSearchDelayTimeTooltip">Change Plugin Search Delay Time</system:String>
136129
<system:String x:Key="FilterComboboxLabel">Advanced Settings:</system:String>
137130
<system:String x:Key="DisplayModeOnOff">Enabled</system:String>
138131
<system:String x:Key="DisplayModePriority">Priority</system:String>
139-
<system:String x:Key="DisplayModeSearchDelay">Search Delay</system:String>
140132
<system:String x:Key="DisplayModeHomeOnOff">Home Page</system:String>
141133
<system:String x:Key="currentPriority">Current Priority</system:String>
142134
<system:String x:Key="newPriority">New Priority</system:String>
@@ -322,11 +314,7 @@
322314
<system:String x:Key="failedToCopy">Failed to copy</system:String>
323315
<system:String x:Key="actionkeyword_tips">Enter the action keywords you like to use to start the plugin and use whitespace to divide them. Use * if you don't want to specify any, and the plugin will be triggered without any action keywords.</system:String>
324316

325-
<!-- Search Delay Settings Dialog -->
326-
<system:String x:Key="searchDelayTimeTitle">Search Delay Time Setting</system:String>
327-
<system:String x:Key="searchDelayTimeTips">Input the search delay time in ms you like to use for the plugin. Input empty if you don't want to specify any, and the plugin will use default search delay time.</system:String>
328-
329-
<!-- Search Delay Settings Dialog -->
317+
<!-- Home Page -->
330318
<system:String x:Key="homeTitle">Home Page</system:String>
331319
<system:String x:Key="homeTips">Enable the plugin home page state if you like to show the plugin results when query is empty.</system:String>
332320

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,13 @@ private void SetupResizeMode()
958958

959959
#endregion
960960

961-
#region Search Delay
961+
#region Search
962962

963963
private void QueryTextBox_TextChanged1(object sender, TextChangedEventArgs e)
964964
{
965965
var textBox = (TextBox)sender;
966966
_viewModel.QueryText = textBox.Text;
967-
_viewModel.Query(_settings.SearchQueryResultsWithDelay);
967+
_viewModel.Query(false);
968968
}
969969

970970
#endregion

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,34 +75,7 @@
7575
Value="{Binding Priority, Mode=TwoWay}" />
7676
</StackPanel>
7777

78-
<StackPanel
79-
x:Name="SearchDelayControl"
80-
VerticalAlignment="Center"
81-
Orientation="Horizontal"
82-
Visibility="{Binding DataContext.IsSearchDelaySelected, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={StaticResource BooleanToVisibilityConverter}}">
83-
<TextBlock
84-
Margin="0 0 8 0"
85-
VerticalAlignment="Center"
86-
FontSize="13"
87-
Foreground="{DynamicResource Color08B}"
88-
Text="{DynamicResource searchDelay}"
89-
ToolTip="{DynamicResource searchDelayToolTip}" />
90-
<ui:NumberBox
91-
Width="120"
92-
Margin="0 0 8 0"
93-
IsEnabled="{Binding SearchDelayEnabled}"
94-
Maximum="1000"
95-
Minimum="0"
96-
PlaceholderText="{Binding DefaultSearchDelay}"
97-
SmallChange="10"
98-
SpinButtonPlacementMode="Compact"
99-
ToolTip="{DynamicResource searchDelayNumberBoxToolTip}"
100-
ToolTipService.InitialShowDelay="0"
101-
ToolTipService.ShowOnDisabled="True"
102-
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}" />
103-
</StackPanel>
104-
105-
<!-- Put OnOffControl after PriorityControl & SearchDelayControl so that it can display correctly -->
78+
<!-- Put OnOffControl after PriorityControl so that it can display correctly -->
10679
<ui:ToggleSwitch
10780
x:Name="HomeOnOffControl"
10881
Margin="0 0 8 0"

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
1+
using System.Collections.Generic;
42
using System.Windows.Forms;
53
using CommunityToolkit.Mvvm.Input;
64
using Flow.Launcher.Core.Resource;
7-
using Flow.Launcher.Infrastructure;
85
using Flow.Launcher.Infrastructure.UserSettings;
96
using Flow.Launcher.Plugin;
107
using Flow.Launcher.Plugin.SharedModels;
@@ -56,19 +53,6 @@ public List<int> ScreenNumbers
5653
public List<LastQueryModeData> LastQueryModes { get; } =
5754
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
5855

59-
public int SearchDelayTimeValue
60-
{
61-
get => Settings.SearchDelayTime;
62-
set
63-
{
64-
if (Settings.SearchDelayTime != value)
65-
{
66-
Settings.SearchDelayTime = value;
67-
OnPropertyChanged();
68-
}
69-
}
70-
}
71-
7256
private void UpdateEnumDropdownLocalizations()
7357
{
7458
DropdownDataGeneric<SearchWindowScreens>.UpdateLabels(SearchWindowScreens);

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using System.Threading.Tasks;
4-
using System.Windows.Controls;
54
using System.Windows;
5+
using System.Windows.Controls;
66
using CommunityToolkit.Mvvm.Input;
77
using Flow.Launcher.Core.Plugin;
88
using Flow.Launcher.Infrastructure.UserSettings;
@@ -66,20 +66,6 @@ public bool IsPrioritySelected
6666
}
6767
}
6868

69-
private bool _isSearchDelaySelected;
70-
public bool IsSearchDelaySelected
71-
{
72-
get => _isSearchDelaySelected;
73-
set
74-
{
75-
if (_isSearchDelaySelected != value)
76-
{
77-
_isSearchDelaySelected = value;
78-
OnPropertyChanged();
79-
}
80-
}
81-
}
82-
8369
private bool _isHomeOnOffSelected;
8470
public bool IsHomeOnOffSelected
8571
{
@@ -156,18 +142,6 @@ private async Task OpenHelperAsync(Button button)
156142
TextWrapping = TextWrapping.Wrap
157143
},
158144
new TextBlock
159-
{
160-
Text = (string)Application.Current.Resources["searchDelay"],
161-
FontSize = 18,
162-
Margin = new Thickness(0, 24, 0, 10),
163-
TextWrapping = TextWrapping.Wrap
164-
},
165-
new TextBlock
166-
{
167-
Text = (string)Application.Current.Resources["searchDelayTimeTips"],
168-
TextWrapping = TextWrapping.Wrap
169-
},
170-
new TextBlock
171145
{
172146
Text = (string)Application.Current.Resources["homeTitle"],
173147
FontSize = 18,
@@ -201,25 +175,16 @@ private void UpdateDisplayModeFromSelection()
201175
case DisplayMode.Priority:
202176
IsOnOffSelected = false;
203177
IsPrioritySelected = true;
204-
IsSearchDelaySelected = false;
205-
IsHomeOnOffSelected = false;
206-
break;
207-
case DisplayMode.SearchDelay:
208-
IsOnOffSelected = false;
209-
IsPrioritySelected = false;
210-
IsSearchDelaySelected = true;
211178
IsHomeOnOffSelected = false;
212179
break;
213180
case DisplayMode.HomeOnOff:
214181
IsOnOffSelected = false;
215182
IsPrioritySelected = false;
216-
IsSearchDelaySelected = false;
217183
IsHomeOnOffSelected = true;
218184
break;
219185
default:
220186
IsOnOffSelected = true;
221187
IsPrioritySelected = false;
222-
IsSearchDelaySelected = false;
223188
IsHomeOnOffSelected = false;
224189
break;
225190
}
@@ -230,6 +195,5 @@ public enum DisplayMode
230195
{
231196
OnOff,
232197
Priority,
233-
SearchDelay,
234198
HomeOnOff
235199
}

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -185,33 +185,6 @@
185185
</cc:Card>
186186
</cc:CardGroup>
187187

188-
<cc:ExCard
189-
Title="{DynamicResource searchDelay}"
190-
Margin="0 14 0 0"
191-
Icon="&#xE961;"
192-
Sub="{DynamicResource searchDelayToolTip}">
193-
<cc:ExCard.SideContent>
194-
<ui:ToggleSwitch
195-
IsOn="{Binding Settings.SearchQueryResultsWithDelay}"
196-
OffContent="{DynamicResource disable}"
197-
OnContent="{DynamicResource enable}" />
198-
</cc:ExCard.SideContent>
199-
<cc:Card
200-
Title="{DynamicResource searchDelayTime}"
201-
Sub="{DynamicResource searchDelayTimeToolTip}"
202-
Type="InsideFit">
203-
<ui:NumberBox
204-
Width="120"
205-
Margin="0 0 0 0"
206-
Maximum="1000"
207-
Minimum="0"
208-
SmallChange="10"
209-
SpinButtonPlacementMode="Compact"
210-
ValidationMode="InvalidInputOverwritten"
211-
Value="{Binding SearchDelayTimeValue}" />
212-
</cc:Card>
213-
</cc:ExCard>
214-
215188
<cc:Card
216189
Title="{DynamicResource homePage}"
217190
Margin="0 14 0 0"

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,15 +1217,6 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
12171217
{
12181218
App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>");
12191219

1220-
if (searchDelay && !currentIsHomeQuery) // Do not delay for home query
1221-
{
1222-
var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;
1223-
1224-
await Task.Delay(searchDelayTime, token);
1225-
1226-
if (token.IsCancellationRequested) return;
1227-
}
1228-
12291220
// Since it is wrapped within a ThreadPool Thread, the synchronous context is null
12301221
// Task.Yield will force it to run in ThreadPool
12311222
await Task.Yield();

0 commit comments

Comments
 (0)