Skip to content

Commit ea4578f

Browse files
committed
Add Keep Height (old behaiver) function
1 parent 188c409 commit ea4578f

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ public string QuerySearchPrecisionString
232232
/// </summary>
233233
public double CustomWindowTop { get; set; } = 0;
234234

235+
public bool KeepMaxResults { get; set; } = false;
235236
public int MaxResultsToShow { get; set; } = 5;
236237
public int ActivateTimes { get; set; }
237238

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
5757
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
5858
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
59+
<system:String x:Key="KeepMaxResults">Keeping Window Max Height</system:String>
60+
<system:String x:Key="KeepMaxResultsToolTip">Window height will keep to fit the maximum number of results</system:String>
5961
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
6062
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
6163
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,17 @@ private void OnResizeEnd()
120120
shadowMargin = 32;
121121
}
122122

123-
if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1)
124-
{
125-
_settings.MaxResultsToShow = 2;
126-
}
127-
else
128-
{
129-
_settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize));
123+
if (!_settings.KeepMaxResults) {
124+
if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1)
125+
{
126+
_settings.MaxResultsToShow = 2;
127+
}
128+
else
129+
{
130+
_settings.MaxResultsToShow = System.Convert.ToInt32(Math.Truncate((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize));
131+
}
130132
}
133+
131134
_settings.WindowSize = Width;
132135
FlowMainWindow.SizeToContent = SizeToContent.Height;
133136
}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ public bool ShouldUsePinyin
151151

152152
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
153153
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
154+
public bool KeepMaxResults
155+
{
156+
get => Settings.KeepMaxResults;
157+
set => Settings.KeepMaxResults = value;
158+
}
154159

155160
public string AlwaysPreviewToolTip => string.Format(
156161
InternationalizationManager.Instance.GetTranslation("AlwaysPreviewToolTip"),

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,24 @@
153153
</cc:Card>
154154
</cc:CardGroup>
155155

156+
<cc:CardGroup Margin="0 30 0 0">
157+
<cc:Card
158+
Title="{DynamicResource KeepMaxResults}"
159+
Icon="&#xe8fd;"
160+
Sub="{DynamicResource KeepMaxResultsToolTip}">
161+
<ui:ToggleSwitch IsOn="{Binding KeepMaxResults}" />
162+
</cc:Card>
163+
<cc:Card
164+
Title="{DynamicResource maxShowResults}"
165+
Sub="{DynamicResource maxShowResultsToolTip}"
166+
Visibility="{Binding KeepMaxResults, Converter={StaticResource BoolToVisibilityConverter}}">
167+
<ComboBox
168+
Width="100"
169+
ItemsSource="{Binding MaxResultsRange}"
170+
SelectedItem="{Binding Settings.MaxResultsToShow}" />
171+
</cc:Card>
172+
</cc:CardGroup>
173+
156174
<cc:Card
157175
Title="{DynamicResource defaultFileManager}"
158176
Margin="0 30 0 0"

0 commit comments

Comments
 (0)