Skip to content

Commit 7587178

Browse files
committed
Adjust Hide function for fix blink issue
1 parent 40ca75a commit 7587178

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using Flow.Launcher.Infrastructure.Image;
2727
using System.Windows.Media;
2828
using CommunityToolkit.Mvvm.DependencyInjection;
29+
using System.Windows.Threading;
2930

3031
namespace Flow.Launcher.ViewModel
3132
{
@@ -1392,7 +1393,7 @@ public void Show()
13921393
});
13931394
}
13941395

1395-
public void Hide()
1396+
public async void Hide()
13961397
{
13971398
lastHistoryIndex = 1;
13981399

@@ -1407,18 +1408,47 @@ public void Hide()
14071408
SelectedResults = Results;
14081409
}
14091410

1410-
// 텍스트 초기화 즉시 적용
1411-
if (Settings.LastQueryMode == LastQueryMode.Empty)
1411+
// 📌 모든 LastQueryMode에서 텍스트 필드 즉시 업데이트 + 강제 UI 갱신
1412+
Application.Current.Dispatcher.Invoke(() =>
14121413
{
1413-
ChangeQueryText(string.Empty);
1414-
}
1414+
switch (Settings.LastQueryMode)
1415+
{
1416+
case LastQueryMode.Empty:
1417+
ChangeQueryText(string.Empty);
1418+
break;
1419+
1420+
case LastQueryMode.Preserved:
1421+
LastQuerySelected = true;
1422+
break;
1423+
1424+
case LastQueryMode.Selected:
1425+
LastQuerySelected = false;
1426+
break;
14151427

1416-
// 즉시 창 숨김
1428+
case LastQueryMode.ActionKeywordPreserved:
1429+
case LastQueryMode.ActionKeywordSelected:
1430+
var newQuery = _lastQuery.ActionKeyword;
1431+
if (!string.IsNullOrEmpty(newQuery))
1432+
newQuery += " ";
1433+
ChangeQueryText(newQuery);
1434+
1435+
if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected)
1436+
LastQuerySelected = false;
1437+
break;
1438+
}
1439+
1440+
// 📌 UI 강제 갱신
1441+
Application.Current.MainWindow.UpdateLayout();
1442+
}, DispatcherPriority.Render); // UI 스레드에서 즉시 실행
1443+
1444+
// 📌 창 숨김 처리 (텍스트 변경 후)
14171445
MainWindowVisibilityStatus = false;
14181446
MainWindowVisibility = Visibility.Collapsed;
14191447
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = false });
14201448
}
14211449

1450+
1451+
14221452
/// <summary>
14231453
/// Checks if Flow Launcher should ignore any hotkeys
14241454
/// </summary>

0 commit comments

Comments
 (0)