Skip to content

Commit 3abcebd

Browse files
committed
Add settings ui
1 parent b1a4681 commit 3abcebd

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public bool HideNotifyIcon
276276
public bool HideWhenDeactivated { get; set; } = true;
277277

278278
public bool SearchQueryResultsWithDelay { get; set; } = false;
279-
public int SearchInputDelay { get; set; } = 150;
279+
public int SearchInputDelay { get; set; } = 120;
280280

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

Flow.Launcher/Languages/en.xaml

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@
9494
<system:String x:Key="hideOnStartupToolTip">Flow Launcher search window is hidden in the tray after starting up.</system:String>
9595
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
9696
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
97+
<system:String x:Key="searchDelay">Search Delay</system:String>
98+
<system:String x:Key="searchDelayToolTip">Delay for a while to search when typing. This reduces interface jumpiness and result load.</system:String>
99+
<system:String x:Key="searchDelayTime">Search Delay Time</system:String>
100+
<system:String x:Key="searchDelayTimeToolTip">Delay time which search results appear when typing is stopped. Default is 120ms.</system:String>
97101
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
98102
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
99103
<system:String x:Key="SearchPrecisionNone">None</system:String>

Flow.Launcher/MainWindow.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ private void QueryTextBox_KeyUp(object sender, KeyEventArgs e)
865865

866866
private IDisposable _reactiveSubscription;
867867

868-
private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
868+
public void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
869869
{
870870
if (_reactiveSubscription != null)
871871
{

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

+16
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ public bool PortableMode
139139
}
140140
}
141141

142+
public bool SearchQueryResultsWithDelay
143+
{
144+
get => Settings.SearchQueryResultsWithDelay;
145+
set
146+
{
147+
Settings.SearchQueryResultsWithDelay = value;
148+
149+
((MainWindow)System.Windows.Application.Current.MainWindow).SetupSearchTextBoxReactiveness(value);
150+
}
151+
}
152+
153+
public IEnumerable<int> SearchInputDelayRange => new List<int>()
154+
{
155+
30, 60, 90, 120, 150, 180, 210, 240, 270, 300
156+
};
157+
142158
public List<LastQueryModeData> LastQueryModes { get; } =
143159
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
144160

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

+22
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,28 @@
172172
OnContent="{DynamicResource enable}" />
173173
</cc:Card>
174174

175+
<cc:CardGroup Margin="0 14 0 0">
176+
<cc:Card
177+
Title="{DynamicResource searchDelay}"
178+
Icon="&#xE961;"
179+
Sub="{DynamicResource searchDelayToolTip}">
180+
<ui:ToggleSwitch
181+
IsOn="{Binding SearchQueryResultsWithDelay}"
182+
OffContent="{DynamicResource disable}"
183+
OnContent="{DynamicResource enable}" />
184+
</cc:Card>
185+
186+
<cc:Card
187+
Title="{DynamicResource searchDelayTime}"
188+
Icon="&#xE916;"
189+
Sub="{DynamicResource searchDelayTimeToolTip}">
190+
<ComboBox
191+
Width="100"
192+
ItemsSource="{Binding SearchInputDelayRange}"
193+
SelectedItem="{Binding Settings.SearchInputDelay}" />
194+
</cc:Card>
195+
</cc:CardGroup>
196+
175197
<cc:CardGroup Margin="0 14 0 0">
176198
<cc:Card Title="{DynamicResource querySearchPrecision}" Sub="{DynamicResource querySearchPrecisionToolTip}">
177199
<ComboBox

0 commit comments

Comments
 (0)