Skip to content

Commit 64a489b

Browse files
committed
Use Hacky way to show up windows when width change.
Clear query to prevent large area of window preventing user change width.
1 parent 08c643a commit 64a489b

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class MainViewModel : BaseModel, ISavable
5252

5353
private ChannelWriter<ResultsForUpdate> _resultsUpdateChannelWriter;
5454
private Task _resultsViewUpdateTask;
55+
private bool _keepVisibility = false;
5556

5657
#endregion
5758

@@ -64,10 +65,20 @@ public MainViewModel(Settings settings)
6465
_lastQuery = new Query();
6566

6667
_settings = settings;
67-
_settings.PropertyChanged += (_, args) =>
68+
_settings.PropertyChanged += async (_, args) =>
6869
{
6970
if (args.PropertyName == nameof(Settings.WindowSize))
7071
{
72+
ChangeQueryText("");
73+
if (MainWindowVisibility == Visibility.Collapsed)
74+
{
75+
ToggleFlowLauncher();
76+
_keepVisibility = true;
77+
await Task.Delay(1000);
78+
_keepVisibility = false;
79+
Application.Current.MainWindow.Activate();
80+
}
81+
7182
OnPropertyChanged(nameof(MainWindowWidth));
7283
}
7384
};
@@ -742,7 +753,7 @@ public async void ToggleFlowLauncher()
742753

743754
public void Hide()
744755
{
745-
if (MainWindowVisibility != Visibility.Collapsed)
756+
if (MainWindowVisibility != Visibility.Collapsed && !_keepVisibility)
746757
{
747758
ToggleFlowLauncher();
748759
}

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,7 @@ public bool DropShadowEffect
309309
public double WindowWidthSize
310310
{
311311
get => Settings.WindowSize;
312-
set
313-
{
314-
Settings.WindowSize = value;
315-
Application.Current.MainWindow.Visibility = Visibility.Visible;
316-
}
312+
set => Settings.WindowSize = value;
317313
}
318314

319315
public bool UseGlyphIcons

0 commit comments

Comments
 (0)