Skip to content

Commit b87237f

Browse files
committed
- Fix Window Width Save
- Removed Unused code - Adjust MinWidth
1 parent c9061a4 commit b87237f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Flow.Launcher/MainWindow.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Name="FlowMainWindow"
1414
Title="Flow Launcher"
1515
Width="{Binding MainWindowWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
16-
MinWidth="430"
16+
MinWidth="400"
1717
MinHeight="30"
1818
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
1919
AllowDrop="True"
@@ -30,6 +30,7 @@
3030
PreviewKeyUp="OnKeyUp"
3131
ResizeMode="CanResize"
3232
ShowInTaskbar="False"
33+
SizeChanged="Window_SizeChanged"
3334
SizeToContent="Height"
3435
Topmost="True"
3536
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public partial class MainWindow
4545
private MainViewModel _viewModel;
4646
private bool _animating;
4747
private bool isArrowKeyPressed = false;
48+
private double WindowWidthForSave;
4849

4950
private MediaPlayer animationSoundWMP;
5051
private SoundPlayer animationSoundWPF;
@@ -120,8 +121,6 @@ private void OnResizeEnd()
120121
_settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount));
121122
}
122123
}
123-
124-
_viewModel.MainWindowWidth = Width;
125124
FlowMainWindow.SizeToContent = SizeToContent.Height;
126125
}
127126

@@ -155,6 +154,9 @@ private void OnPaste(object sender, DataObjectPastingEventArgs e)
155154
private async void OnClosing(object sender, CancelEventArgs e)
156155
{
157156
_notifyIcon.Visible = false;
157+
/* In this timing, window alreayd closed and it effect to window size. So at this point, whenever the window changes,
158+
we recall the width we've stored as a variable and specify it in the settings. This way, the existing window size will be recalled on the next run.*/
159+
_settings.WindowSize = WindowWidthForSave;
158160
App.API.SaveAppAllSettings();
159161
e.Cancel = true;
160162
await PluginManager.DisposePluginsAsync();
@@ -832,5 +834,10 @@ private void QueryTextBox_KeyUp(object sender, KeyEventArgs e)
832834
be.UpdateSource();
833835
}
834836
}
837+
838+
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
839+
{
840+
WindowWidthForSave = Width;
841+
}
835842
}
836843
}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,6 @@ public bool KeepMaxResults
173173

174174
public string DateText => DateTime.Now.ToString(DateFormat, CultureInfo.CurrentCulture);
175175

176-
public double WindowWidthSize
177-
{
178-
get => Settings.WindowSize;
179-
set => Settings.WindowSize = value;
180-
}
181-
182176
public bool UseGlyphIcons
183177
{
184178
get => Settings.UseGlyphIcons;

0 commit comments

Comments
 (0)