Skip to content

Fluent Window #3271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 119 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
3e9a0e2
Added basic structure for fluent window
onesounds Feb 22, 2025
270f5b3
Base Structure for fluent window
onesounds Feb 23, 2025
53cb94d
Fix first load issue
onesounds Feb 24, 2025
278121b
Remove delay for hide
onesounds Feb 24, 2025
db5036a
Fix other delays when hide window
onesounds Feb 24, 2025
41b05b3
Replace dll import with PInvoke for code quality
Jack251970 Feb 24, 2025
10bbccb
Add theme compatibility code
onesounds Feb 24, 2025
77e0234
Merge branch '250223FluentTest2' of https://github.com/onesounds/Flow…
onesounds Feb 24, 2025
4426bed
Merge Dev
onesounds Feb 28, 2025
912c991
Fix theme.cs
onesounds Feb 28, 2025
bbdb589
Add BGcolor style for blur mode
onesounds Mar 1, 2025
6a736a8
Add bgcolor for blur
onesounds Mar 1, 2025
70543d2
Add WindowCornerRadius Property function
onesounds Mar 1, 2025
5b81cf5
Adjust Shadow Effect
onesounds Mar 1, 2025
f00f98c
Add Proprerty for blur themes
onesounds Mar 1, 2025
2cd5174
Adjust themes
onesounds Mar 2, 2025
ff18abc
Change Window type
onesounds Mar 4, 2025
f0b1422
Change AddShadow Logic
onesounds Mar 4, 2025
90828d9
Fix Shadow Timing
onesounds Mar 4, 2025
f712f63
Adjust Animator
onesounds Mar 5, 2025
4ab5ef0
Adjust Animation
onesounds Mar 6, 2025
2da2012
Adjust Animation
onesounds Mar 6, 2025
2a55cab
Fix Show Function
onesounds Mar 6, 2025
40ca75a
Adjust Comment, Adjust Shadow Timing.
onesounds Mar 6, 2025
7587178
Adjust Hide function for fix blink issue
onesounds Mar 6, 2025
4042231
Fix blink issue when fast trigering show/hide
onesounds Mar 6, 2025
a65dc65
Change Show/Hide function to using DWM
onesounds Mar 6, 2025
1bfec0a
Fix Animation
onesounds Mar 6, 2025
624fa0e
Fix Hide
onesounds Mar 6, 2025
1b22d9c
Fix Clock Animation
onesounds Mar 6, 2025
2710de1
Fix Search Icon Opacity
onesounds Mar 6, 2025
46cdb2a
Fix Blink issue when hidestartup mode (hide on)
onesounds Mar 8, 2025
01d081d
Revert Startup Blinking
onesounds Mar 8, 2025
b8748d6
Fix Render Blink
onesounds Mar 8, 2025
c63bb21
Added Windows 10 check code
onesounds Mar 8, 2025
1345470
- Revert blinking fix
onesounds Mar 8, 2025
7e622b7
Add BackdropType in setting
onesounds Mar 9, 2025
9510a07
Add Mica Background option
onesounds Mar 9, 2025
f5d9155
Add Mica control in blur function
onesounds Mar 9, 2025
4fd5e15
- Adjust Setting order
onesounds Mar 11, 2025
1c79d51
Fix Change Theme render timing
onesounds Mar 11, 2025
ba02a3c
Add Strings
onesounds Mar 11, 2025
f4b074c
Fix shadow effec tissue
onesounds Mar 12, 2025
ea5b3f1
Disable backdrop control when use non-blur theme
onesounds Mar 12, 2025
aabe967
Adjust Dropshadow control disable
onesounds Mar 13, 2025
ec5d52e
Fix Preview background
onesounds Mar 13, 2025
72d2b7e
Change default pending color
onesounds Mar 13, 2025
73c5f39
Merge Dev
onesounds Mar 13, 2025
dd1f439
Adjust strings and icon
onesounds Mar 13, 2025
6c1730e
Merge Dev
onesounds Mar 13, 2025
88f8274
Remove duplicated strings
onesounds Mar 13, 2025
2cd769b
Fix UI thread issue and preview
onesounds Mar 14, 2025
c7a2dee
Fix Keeping shadow when change page issue
onesounds Mar 14, 2025
caa5a48
Use enum instead of constants & Use vm property
Jack251970 Mar 14, 2025
8484c2b
Fix color scheme change issue & Code cleanup
Jack251970 Mar 14, 2025
c17dcad
Revert "Use enum instead of constants"
Jack251970 Mar 14, 2025
57d206f
Fix SystemBG color select
onesounds Mar 14, 2025
887be64
Merge branch '250223FluentTest2' of https://github.com/onesounds/Flow…
onesounds Mar 14, 2025
e527e6c
Fix Backdrop reset when change theme
onesounds Mar 14, 2025
fd344a3
Fix Preview border
onesounds Mar 14, 2025
4e15cb0
Comment cleanup
onesounds Mar 15, 2025
d90b82a
Code Cleanup
onesounds Mar 15, 2025
7c8d45d
- Fix Clock Right margin
onesounds Mar 15, 2025
aeb3f22
- rollback pin theme to legacy
onesounds Mar 15, 2025
53d647f
Adjust Themes for fluent
onesounds Mar 16, 2025
9ec6d5c
Fix clock visibilty when open context menu
onesounds Mar 16, 2025
fa5bfd3
Fix BlurWhite theme
onesounds Mar 16, 2025
ce55303
- Fix Logic for dwmBG
onesounds Mar 16, 2025
0086a9e
Add a condition to disable blur on unsupported Windows versions.
onesounds Mar 16, 2025
c792544
Adjust UI
onesounds Mar 16, 2025
a98b7b7
Merge branch 'dev' into 250223FluentTest2
Jack251970 Mar 16, 2025
29c6f12
Code cleanup
Jack251970 Mar 16, 2025
07b0e72
Code cleanup
Jack251970 Mar 16, 2025
e4ade45
Use PInvoke.DwmSetWindowAttribute instead of DllImport
Jack251970 Mar 16, 2025
db37ab7
Use PInvoke.DwmSetWindowAttribute instead of DllImport
Jack251970 Mar 16, 2025
7a85439
Improve code quality
Jack251970 Mar 16, 2025
2dcbe7f
Remove old blur handling codes
Jack251970 Mar 16, 2025
200c32b
Code cleanup
Jack251970 Mar 16, 2025
cff400b
Revert main window xaml change
Jack251970 Mar 16, 2025
7c23aeb
Improve code quality
Jack251970 Mar 16, 2025
07c5fa4
Improve code quality
Jack251970 Mar 16, 2025
2ed5de3
Improve sys plugin theme selector
Jack251970 Mar 16, 2025
cd46c79
Fix build issue
Jack251970 Mar 16, 2025
9a6175e
Remove useless position initialization & Remove useless dispatcher in…
Jack251970 Mar 16, 2025
6f093cf
Merge branch 'dev' into 250223FluentTest2
Jack251970 Mar 16, 2025
3966290
Refresh frame after position is intialized
Jack251970 Mar 16, 2025
2ea303f
Code cleanup
Jack251970 Mar 16, 2025
70e7f82
Fix Blink
onesounds Mar 16, 2025
ecc9f0d
Fix acrylic backdrop flicker issue
Jack251970 Mar 16, 2025
09d66f5
Merge branch '250223FluentTest2' of https://github.com/onesounds/Flow…
onesounds Mar 16, 2025
8b10973
Revert "Fix Blink"
Jack251970 Mar 16, 2025
1ca17aa
Code cleanup
Jack251970 Mar 16, 2025
2cd1683
Improve code quality
Jack251970 Mar 16, 2025
a98a033
Improve code quality
Jack251970 Mar 16, 2025
7d62ded
Improve code quality
Jack251970 Mar 16, 2025
49f1d79
Fix SetWindowLong issue
Jack251970 Mar 16, 2025
bf5591c
Fix position set issue
Jack251970 Mar 16, 2025
0bcc187
Keep user settings when changing theme
Jack251970 Mar 16, 2025
2b6e1bf
Improve code quality
Jack251970 Mar 17, 2025
da30e2e
Improve code quality
Jack251970 Mar 17, 2025
a2f70f4
Organize usings
Jack251970 Mar 17, 2025
1e6bbdd
Organize usings
Jack251970 Mar 17, 2025
698217f
Improve code quality
Jack251970 Mar 17, 2025
4d080a9
Fix build issue
Jack251970 Mar 17, 2025
841cc06
Fix blink clock/icon animation issue when show/hide repeatly
onesounds Mar 17, 2025
f3a5365
Merge remote-tracking branch 'origin/250223FluentTest2' into 250223Fl…
onesounds Mar 17, 2025
0741231
Adjust Flickering code
onesounds Mar 17, 2025
95f151b
Organize usings
Jack251970 Mar 17, 2025
711865d
Use local variable for storyboard
Jack251970 Mar 17, 2025
7876fa1
Fix possible cancel token issue
Jack251970 Mar 17, 2025
570d9ce
Remove useless logic
Jack251970 Mar 17, 2025
bfa7622
Improve performance
Jack251970 Mar 17, 2025
df8f2f0
Merge branch 'dev' into 250223FluentTest2
Jack251970 Mar 17, 2025
8493fa5
Merge branch 'dev' into 250223FluentTest2
Jack251970 Mar 18, 2025
a3322fc
Remove Corner Type
onesounds Mar 18, 2025
4731d88
Removed window animation storyboard
onesounds Mar 18, 2025
aaca0c0
Change Comment to english
onesounds Mar 18, 2025
9cb31c8
Improve code quality
Jack251970 Mar 19, 2025
944393c
Improve code quality
Jack251970 Mar 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 190 additions & 1 deletion Flow.Launcher.Core/Resource/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using System.Windows.Shell;
using static Flow.Launcher.Core.Resource.Theme.ParameterTypes;
using System.Runtime.InteropServices;
using System.Windows.Interop;
using System.Diagnostics;

namespace Flow.Launcher.Core.Resource
{
Expand Down Expand Up @@ -59,6 +63,190 @@ public Theme()
_oldTheme = Path.GetFileNameWithoutExtension(_oldResource.Source.AbsolutePath);
}

#region Blur Handling
public class ParameterTypes
{

[Flags]
public enum DWMWINDOWATTRIBUTE
{
DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
DWMWA_SYSTEMBACKDROP_TYPE = 38,
DWMWA_TRANSITIONS_FORCEDISABLED = 3,
DWMWA_BORDER_COLOR
}

[StructLayout(LayoutKind.Sequential)]
public struct MARGINS
{
public int cxLeftWidth; // width of left border that retains its size
public int cxRightWidth; // width of right border that retains its size
public int cyTopHeight; // height of top border that retains its size
public int cyBottomHeight; // height of bottom border that retains its size
};
}

public static class Methods
{
[DllImport("DwmApi.dll")]
static extern int DwmExtendFrameIntoClientArea(
IntPtr hwnd,
ref ParameterTypes.MARGINS pMarInset);

[DllImport("dwmapi.dll")]
static extern int DwmSetWindowAttribute(IntPtr hwnd, ParameterTypes.DWMWINDOWATTRIBUTE dwAttribute, ref int pvAttribute, int cbAttribute);

public static int ExtendFrame(IntPtr hwnd, ParameterTypes.MARGINS margins)
=> DwmExtendFrameIntoClientArea(hwnd, ref margins);

public static int SetWindowAttribute(IntPtr hwnd, ParameterTypes.DWMWINDOWATTRIBUTE attribute, int parameter)
=> DwmSetWindowAttribute(hwnd, attribute, ref parameter, Marshal.SizeOf<int>());
}

Window mainWindow = Application.Current.MainWindow;

public void RefreshFrame()
{
IntPtr mainWindowPtr = new WindowInteropHelper(mainWindow).Handle;
if (mainWindowPtr == IntPtr.Zero)
return;

HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr);
if (mainWindowSrc == null)
return;
//mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 255, 181, 178);

ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS();
margins.cxLeftWidth = -1;
margins.cxRightWidth = -1;
margins.cyTopHeight = -1;
margins.cyBottomHeight = -1;
Methods.ExtendFrame(mainWindowSrc.Handle, margins);

// Remove OS minimizing/maximizing animation
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3);

//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
SetBlurForWindow();
}



/// <summary>
/// Sets the blur for a window via SetWindowCompositionAttribute
/// </summary>
public void SetBlurForWindow()
{

//SetWindowAccent();
var dict = GetThemeResourceDictionary(Settings.Theme);
if (dict == null)
return;

var windowBorderStyle = dict["WindowBorderStyle"] as Style;
if (windowBorderStyle == null)
return;
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
if (BlurEnabled)
{
//mainWindow.WindowStyle = WindowStyle.SingleBorderWindow;
BlurColor(BlurMode());
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
}
else
{
//mainWindow.WindowStyle = WindowStyle.None;
//if (windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background") != null)
//{
// windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
//}
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 1);
}
UpdateResourceDictionary(dict);
}

public void BlurColor(string Color)
{

if (Color == "Light")
{
//mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
}
else if (Color == "Dark")
{
//mainWindow.Background = new SolidColorBrush(darkBGcolor.Value);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
}
else /* Case of "Auto" Blur Type Theme */
{
//if (_isDarkTheme())
//{
// mainWindow.Background = new SolidColorBrush(darkBGcolor.Value);
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
//}
//else
//{
// mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value);
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
//}
//mainWindow.Background = new SolidColorBrush(Colors.Red);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1); }

}

public bool IsBlurTheme()
{
if (Environment.OSVersion.Version >= new Version(6, 2))
{
var resource = Application.Current.TryFindResource("ThemeBlurEnabled");

if (resource is bool)
return (bool)resource;

return false;
}

return false;
}
public string BlurMode()
{
if (Environment.OSVersion.Version >= new Version(6, 2))
{
var resource = Application.Current.TryFindResource("BlurMode");

if (resource is string)
return (string)resource;

return null;
}

return null;
}

//public SolidColorBrush BGColor(string colorBgKey)
//{
// var defaultBG = Application.Current.TryFindResource("DefaultBG");
// var darkBG = Application.Current.TryFindResource("DarkBG");

// if (colorBgKey == "")
// {
// var resource = Application.Current.TryFindResource("BlurMode");

// if (resource is string)
// return (SolidColorBrush)resource;

// return new SolidColorBrush(Colors.DarkGray);
// }

// return null;
//}

#endregion

private void MakeSureThemeDirectoriesExist()
{
foreach (var dir in _themeDirectories.Where(dir => !Directory.Exists(dir)))
Expand Down Expand Up @@ -102,7 +290,8 @@ public bool ChangeTheme(string theme)
if (Settings.UseDropShadowEffect && !BlurEnabled)
AddDropShadowEffectToCurrentTheme();

Win32Helper.SetBlurForWindow(Application.Current.MainWindow, BlurEnabled);
//Win32Helper.SetBlurForWindow(Application.Current.MainWindow, BlurEnabled);
SetBlurForWindow();
}
catch (DirectoryNotFoundException)
{
Expand Down
22 changes: 22 additions & 0 deletions Flow.Launcher.Infrastructure/Win32Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ namespace Flow.Launcher.Infrastructure
{
public static class Win32Helper
{
private enum DwmSystemBackdropType
{
DWMSBT_AUTO = 0,
DWMSBT_NONE = 1,
DWMSBT_MICA = 2,
DWMSBT_ACRYLIC = 3,
DWMSBT_TABBED = 4
}

private const int DWMWA_SYSTEMBACKDROP_TYPE = 38;

[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref DwmSystemBackdropType pvAttribute, int cbAttribute);

public static void SetMicaForWindow(Window window, bool enableMica)
{
var windowHelper = new WindowInteropHelper(window);
windowHelper.EnsureHandle();

DwmSystemBackdropType backdropType = enableMica ? DwmSystemBackdropType.DWMSBT_MICA : DwmSystemBackdropType.DWMSBT_NONE;
DwmSetWindowAttribute(windowHelper.Handle, DWMWA_SYSTEMBACKDROP_TYPE, ref backdropType, sizeof(int));
}
#region Blur Handling

/*
Expand Down
8 changes: 4 additions & 4 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
MinHeight="30"
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
AllowDrop="True"
AllowsTransparency="True"
Background="Transparent"
AllowsTransparency="False"
Background="#E12E2E2E"
Closing="OnClosing"
Deactivated="OnDeactivated"
Icon="Images/app.png"
SourceInitialized="OnSourceInitialized"
Initialized="OnInitialized"
Left="{Binding Settings.WindowLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Loaded="OnLoaded"
Expand All @@ -31,10 +30,11 @@
ResizeMode="CanResize"
ShowInTaskbar="False"
SizeToContent="Height"
SourceInitialized="OnSourceInitialized"
Topmost="True"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
WindowStartupLocation="Manual"
WindowStyle="None"
WindowStyle="SingleBorderWindow"
mc:Ignorable="d">
<!-- WindowChrome -->
<WindowChrome.WindowChrome>
Expand Down
8 changes: 6 additions & 2 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ public MainWindow(Settings settings, MainViewModel mainVM)
InitializePosition();

InitSoundEffects();

DataObject.AddPastingHandler(QueryTextBox, OnPaste);

this.Loaded += (_, _) =>
{
var handle = new WindowInteropHelper(this).Handle;
Expand Down Expand Up @@ -108,6 +106,7 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
return IntPtr.Zero;
}


private void OnResizeEnd()
{
int shadowMargin = 0;
Expand Down Expand Up @@ -182,6 +181,11 @@ private void OnInitialized(object sender, EventArgs e)

private void OnLoaded(object sender, RoutedEventArgs _)
{
Dispatcher.BeginInvoke((Action)(() =>
{
ThemeManager.Instance.RefreshFrame();
}), DispatcherPriority.Background);

// MouseEventHandler
PreviewMouseMove += MainPreviewMouseMove;
CheckFirstLaunch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public Theme.ThemeData SelectedTheme

if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect)
DropShadowEffect = false;
ThemeManager.Instance.RefreshFrame();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/Themes/BlurBlack.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries>

<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Auto</system:String>
<Style x:Key="WindowRadius" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="0" />
</Style>
Expand Down
4 changes: 3 additions & 1 deletion Flow.Launcher/Themes/Win11Light.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Name: Windows 11
IsDark: True
HasBlur: False
HasBlur: True
-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Expand All @@ -12,6 +12,8 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Auto</system:String>
<Style
x:Key="BulletStyle"
BasedOn="{StaticResource BaseBulletStyle}"
Expand Down
30 changes: 14 additions & 16 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@ public void Show()
public async void Hide()
{
lastHistoryIndex = 1;

// Trick for no delay
MainWindowOpacity = 0;

Expand All @@ -1408,36 +1409,33 @@ public async void Hide()
SelectedResults = Results;
}

// 텍스트 초기화 즉시 적용
if (Settings.LastQueryMode == LastQueryMode.Empty)
{
ChangeQueryText(string.Empty);
await Task.Yield(); // UI 갱신 보장
}

switch (Settings.LastQueryMode)
{
case LastQueryMode.Empty:
ChangeQueryText(string.Empty);
await Task.Delay(100); //Time for change to opacity
break;
case LastQueryMode.Preserved:
if (Settings.UseAnimation)
await Task.Delay(100);
LastQuerySelected = true;
break;
case LastQueryMode.Selected:
if (Settings.UseAnimation)
await Task.Delay(100);
LastQuerySelected = false;
LastQuerySelected = (Settings.LastQueryMode == LastQueryMode.Preserved);
break;
case LastQueryMode.ActionKeywordPreserved or LastQueryMode.ActionKeywordSelected:

case LastQueryMode.ActionKeywordPreserved:
case LastQueryMode.ActionKeywordSelected:
var newQuery = _lastQuery.ActionKeyword;
if (!string.IsNullOrEmpty(newQuery))
newQuery += " ";
ChangeQueryText(newQuery);
if (Settings.UseAnimation)
await Task.Delay(100);

if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected)
LastQuerySelected = false;
break;
default:
throw new ArgumentException($"wrong LastQueryMode: <{Settings.LastQueryMode}>");
}

// 창 숨김 즉시 처리
MainWindowVisibilityStatus = false;
MainWindowVisibility = Visibility.Collapsed;
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = false });
Expand Down
Loading