Fix UI thread issue and preview

This commit is contained in:
DB p 2025-03-14 10:00:31 +09:00
parent 88f8274476
commit 2cd769b1e9
9 changed files with 234 additions and 330 deletions

View file

@ -132,10 +132,20 @@ namespace Flow.Launcher.Core.Resource
=> DwmSetWindowAttribute(hwnd, attribute, ref parameter, Marshal.SizeOf<int>()); => DwmSetWindowAttribute(hwnd, attribute, ref parameter, Marshal.SizeOf<int>());
} }
System.Windows.Window mainWindow = Application.Current.MainWindow; private System.Windows.Window GetMainWindow()
{
return Application.Current.Dispatcher.Invoke(() => Application.Current.MainWindow);
}
public void RefreshFrame() public void RefreshFrame()
{ {
Application.Current.Dispatcher.Invoke(() =>
{
System.Windows.Window mainWindow = Application.Current.MainWindow;
if (mainWindow == null)
return;
IntPtr mainWindowPtr = new WindowInteropHelper(mainWindow).Handle; IntPtr mainWindowPtr = new WindowInteropHelper(mainWindow).Handle;
if (mainWindowPtr == IntPtr.Zero) if (mainWindowPtr == IntPtr.Zero)
return; return;
@ -168,14 +178,18 @@ namespace Flow.Launcher.Core.Resource
{ {
AutoDropShadow(); AutoDropShadow();
} }
}, DispatcherPriority.Normal);
} }
public void AutoDropShadow() public void AutoDropShadow()
{ {
SetWindowCornerPreference("Default");
RemoveDropShadowEffectFromCurrentTheme();
if (_settings.UseDropShadowEffect) if (_settings.UseDropShadowEffect)
{ {
RemoveDropShadowEffectFromCurrentTheme(); //RemoveDropShadowEffectFromCurrentTheme();
if (BlurEnabled) if (BlurEnabled)
{ {
SetWindowCornerPreference("Round"); SetWindowCornerPreference("Round");
@ -188,7 +202,7 @@ namespace Flow.Launcher.Core.Resource
} }
else else
{ {
RemoveDropShadowEffectFromCurrentTheme(); //RemoveDropShadowEffectFromCurrentTheme();
if (BlurEnabled) if (BlurEnabled)
{ {
SetWindowCornerPreference("Default"); SetWindowCornerPreference("Default");
@ -202,6 +216,12 @@ namespace Flow.Launcher.Core.Resource
public void SetWindowCornerPreference(string cornerType) public void SetWindowCornerPreference(string cornerType)
{ {
Application.Current.Dispatcher.Invoke(() =>
{
System.Windows.Window mainWindow = GetMainWindow();
if (mainWindow == null)
return;
DWM_WINDOW_CORNER_PREFERENCE preference = cornerType switch DWM_WINDOW_CORNER_PREFERENCE preference = cornerType switch
{ {
"DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound, "DoNotRound" => DWM_WINDOW_CORNER_PREFERENCE.DoNotRound,
@ -212,13 +232,22 @@ namespace Flow.Launcher.Core.Resource
}; };
SetWindowCornerPreference(mainWindow, preference); SetWindowCornerPreference(mainWindow, preference);
}, DispatcherPriority.Normal);
} }
public void SetCornerForWindow() public void SetCornerForWindow()
{
Application.Current.Dispatcher.Invoke(() =>
{ {
var dict = GetThemeResourceDictionary(_settings.Theme); var dict = GetThemeResourceDictionary(_settings.Theme);
if (dict == null) if (dict == null)
return; return;
System.Windows.Window mainWindow = Application.Current.MainWindow;
if (mainWindow == null)
return;
if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode) if (dict.Contains("CornerType") && dict["CornerType"] is string cornerMode)
{ {
DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch DWM_WINDOW_CORNER_PREFERENCE preference = cornerMode switch
@ -230,80 +259,87 @@ namespace Flow.Launcher.Core.Resource
}; };
SetWindowCornerPreference(mainWindow, preference); SetWindowCornerPreference(mainWindow, preference);
} }
else else
{ {
SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default); SetWindowCornerPreference(mainWindow, DWM_WINDOW_CORNER_PREFERENCE.Default);
}
}, DispatcherPriority.Normal);
}
}
}
/// <summary> /// <summary>
/// Sets the blur for a window via SetWindowCompositionAttribute /// Sets the blur for a window via SetWindowCompositionAttribute
/// </summary> /// </summary>
public void SetBlurForWindow() public void SetBlurForWindow()
{
Application.Current.Dispatcher.Invoke(() =>
{ {
var dict = GetThemeResourceDictionary(_settings.Theme); var dict = GetThemeResourceDictionary(_settings.Theme);
if (dict == null) if (dict == null)
return; return;
var windowBorderStyle = dict["WindowBorderStyle"] as Style; var windowBorderStyle = dict.Contains("WindowBorderStyle") ? dict["WindowBorderStyle"] as Style : null;
if (windowBorderStyle == null) if (windowBorderStyle == null)
return; return;
System.Windows.Window mainWindow = GetMainWindow();
if (mainWindow == null)
return;
// ✅ 테마가 블러를 지원하는지 확인
bool hasBlur = dict.Contains("ThemeBlurEnabled") && dict["ThemeBlurEnabled"] is bool b && b;
if (!hasBlur)
{
_settings.BackdropType = BackdropTypes.None; // 🔥 블러가 없는 테마는 강제 None 처리
}
// ✅ 설정된 BackdropType 확인 // ✅ 설정된 BackdropType 확인
int backdropValue = _settings.BackdropType switch int backdropValue = _settings.BackdropType switch
{ {
BackdropTypes.Acrylic => 3, // Acrylic (DWM_SYSTEMBACKDROP_TYPE = 2) BackdropTypes.Acrylic => 3, // Acrylic
BackdropTypes.Mica => 2, // Mica (DWM_SYSTEMBACKDROP_TYPE = 3) BackdropTypes.Mica => 2, // Mica
BackdropTypes.MicaAlt => 4, // MicaAlt (DWM_SYSTEMBACKDROP_TYPE = 4) BackdropTypes.MicaAlt => 4, // MicaAlt
_ => 0 // None (DWM_SYSTEMBACKDROP_TYPE = 0) _ => 0 // None
}; };
Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~"); if (BlurEnabled && hasBlur)
Debug.WriteLine($"Backdrop Mode: {BlurMode()}, DWM Value: {backdropValue}");
if (BlurEnabled)
{ {
// ✅ Mica 또는 MicaAlt인 경우 배경을 투명하게 설정 // ✅ Mica 또는 MicaAlt인 경우 배경을 투명하게 설정
if (_settings.BackdropType == BackdropTypes.Mica || _settings.BackdropType == BackdropTypes.MicaAlt) if (_settings.BackdropType == BackdropTypes.Mica || _settings.BackdropType == BackdropTypes.MicaAlt)
{ {
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background")); windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)))); // 드래그 가능 투명색 windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Color.FromArgb(1, 0, 0, 0))));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue); Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue);
ThemeModeColorforMica(BlurMode()); // ✅ 테마 모드 적용 ColorizeWindow(GetSystemBG());
} }
else if (_settings.BackdropType == BackdropTypes.Acrylic) else if (_settings.BackdropType == BackdropTypes.Acrylic)
{ {
windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background")); windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent))); windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
//Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue); Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue);
ThemeModeColor(BlurMode()); // ✅ 테마 모드 적용 ColorizeWindow(GetSystemBG());
} }
else else
{ {
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue); Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue);
ThemeModeColor(BlurMode()); // ✅ 테마 모드 적용 ColorizeWindow(GetSystemBG());
//windowBorderStyle.Setters.Remove(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
//windowBorderStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.Transparent)));
} }
} }
else else
{ {
// ✅ Blur가 비활성화되면 기본 스타일 적용 // ✅ Blur가 비활성화되면 기본 스타일 적용
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 0); Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 0);
ThemeModeColor(BlurMode()); ColorizeWindow(GetSystemBG());
} }
UpdateResourceDictionary(dict); UpdateResourceDictionary(dict);
}, DispatcherPriority.Normal);
} }
// Get Background Color from WindowBorderStyle when there not color for BG. // Get Background Color from WindowBorderStyle when there not color for BG.
private Color GetWindowBorderStyleBackground() private Color GetWindowBorderStyleBackground()
{ {
@ -347,247 +383,110 @@ namespace Flow.Launcher.Core.Resource
return Colors.Transparent; // Default is transparent return Colors.Transparent; // Default is transparent
} }
private void ApplyPreviewBackground(Color bgColor) private void ApplyPreviewBackground(Color? bgColor = null)
{ {
if (bgColor == null) return;
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
Style baseStyle = null; // 1. 기존 WindowBorderStyle을 복사
var previewStyle = new Style(typeof(Border));
// ✅ `WindowBorderStyle`이 존재하면 가져오기
if (Application.Current.Resources.Contains("WindowBorderStyle")) if (Application.Current.Resources.Contains("WindowBorderStyle"))
{ {
baseStyle = Application.Current.Resources["WindowBorderStyle"] as Style; var originalStyle = Application.Current.Resources["WindowBorderStyle"] as Style;
} if (originalStyle != null)
// ✅ `WindowBorderStyle`이 없으면 `Base.xaml`의 기본 스타일 사용
if (baseStyle == null && Application.Current.Resources.Contains("BaseWindowBorderStyle"))
{ {
baseStyle = Application.Current.Resources["BaseWindowBorderStyle"] as Style; foreach (var setter in originalStyle.Setters.OfType<Setter>())
}
// ✅ 투명도가 존재하면 불투명한 색상으로 변경
if (bgColor.A < 255)
{ {
bgColor = Color.FromRgb(bgColor.R, bgColor.G, bgColor.B); // 알파값 제거 previewStyle.Setters.Add(new Setter(setter.Property, setter.Value));
} }
// ✅ 기존 스타일이 존재하면 복사하여 새로운 스타일 생성
if (baseStyle != null)
{
var newStyle = new Style(typeof(Border));
// ✅ 기존 스타일의 Setter를 복사 (Background 제외)
foreach (var setter in baseStyle.Setters.OfType<Setter>())
{
if (setter.Property != Border.BackgroundProperty) // Background는 새 값으로 대체
{
newStyle.Setters.Add(new Setter(setter.Property, setter.Value));
} }
} }
// ✅ 새로운 Background Setter 추가 // 2. 투명도 제거 후 background 적용
newStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(bgColor))); Color backgroundColor = Color.FromRgb(bgColor.Value.R, bgColor.Value.G, bgColor.Value.B);
previewStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(backgroundColor)));
// ✅ 새 스타일을 `PreviewWindowBorderStyle`로 적용 // 3. 기타 설정 추가
Application.Current.Resources["PreviewWindowBorderStyle"] = newStyle; previewStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(0)));
} previewStyle.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(5)));
else previewStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
{ previewStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
// ✅ `WindowBorderStyle`이 없으면 기본 스타일 생성
var defaultStyle = new Style(typeof(Border));
defaultStyle.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(bgColor)));
defaultStyle.Setters.Add(new Setter(Border.BorderThicknessProperty, new Thickness(0)));
defaultStyle.Setters.Add(new Setter(Border.CornerRadiusProperty, new CornerRadius(5)));
defaultStyle.Setters.Add(new Setter(Border.UseLayoutRoundingProperty, true));
defaultStyle.Setters.Add(new Setter(Border.SnapsToDevicePixelsProperty, true));
Application.Current.Resources["PreviewWindowBorderStyle"] = defaultStyle; Application.Current.Resources["PreviewWindowBorderStyle"] = previewStyle;
}
}, DispatcherPriority.Render); }, DispatcherPriority.Render);
} }
public void ColorizeWindow(string Mode)
{
public void ThemeModeColor(string Mode) Application.Current.Dispatcher.Invoke(() =>
{ {
var dict = GetThemeResourceDictionary(_settings.Theme); var dict = GetThemeResourceDictionary(_settings.Theme);
if (dict == null) return;
Color lightBG; var mainWindow = Application.Current.MainWindow;
Color darkBG; if (mainWindow == null) return;
// get lightBG value. if not, get windowborderstyle's background. // ✅ 블러 테마인지 확인
bool hasBlur = dict.Contains("ThemeBlurEnabled") && dict["ThemeBlurEnabled"] is bool b && b;
Color LightBG;
Color DarkBG;
// LightBG 값 가져오기 (없으면 WindowBorderStyle의 배경색 사용)
try try
{ {
lightBG = dict.Contains("lightBG") ? (Color)dict["lightBG"] : GetWindowBorderStyleBackground(); LightBG = dict.Contains("LightBG") ? (Color)dict["LightBG"] : GetWindowBorderStyleBackground();
} }
catch (Exception) catch (Exception)
{ {
// if not lightBG, use windowborderstyle's background. LightBG = GetWindowBorderStyleBackground();
lightBG = GetWindowBorderStyleBackground();
} }
// get darkBG value, (if not, use lightBG) // DarkBG 값 가져오기 (없으면 LightBG 사용)
try try
{ {
darkBG = dict.Contains("darkBG") ? (Color)dict["darkBG"] : lightBG; DarkBG = dict.Contains("DarkBG") ? (Color)dict["DarkBG"] : LightBG;
} }
catch (Exception) catch (Exception)
{ {
darkBG = lightBG; // if not darkBG, use lightBG DarkBG = LightBG;
} }
if (Mode == "Auto") // ✅ 설정의 ColorScheme을 우선 사용
{
int themeValue = (int)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1); int themeValue = (int)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1);
string colorScheme = _settings.ColorScheme; bool isSystemDark = themeValue == 0;
bool isDarkMode = themeValue == 0; // 0 is dark mode. bool useDarkMode = Mode == "Dark" || (Mode == "Auto" && _settings.ColorScheme == "System" && isSystemDark) || (_settings.ColorScheme == "Dark");
if (colorScheme == "System") Color selectedBG = useDarkMode ? DarkBG : LightBG;
ApplyPreviewBackground(selectedBG);
// ✅ Windows 10 테마(HasBlur=False)는 mainWindow.Background를 설정하지 않음
if (!hasBlur)
{ {
if (isDarkMode) mainWindow.Background = Brushes.Transparent;
{
ApplyPreviewBackground(darkBG);
mainWindow.Background = new SolidColorBrush(darkBG);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
return;
} }
else else
{ {
ApplyPreviewBackground(lightBG); // ✅ 블러 테마일 경우만 배경을 투명하게 설정
mainWindow.Background = new SolidColorBrush(lightBG); if (_settings.BackdropType == BackdropTypes.Mica || _settings.BackdropType == BackdropTypes.MicaAlt)
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0); {
return; mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
}
} }
else else
{ {
if (colorScheme == "Dark") mainWindow.Background = new SolidColorBrush(selectedBG);
{
ApplyPreviewBackground(darkBG);
mainWindow.Background = new SolidColorBrush(darkBG);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
return;
}
else if (colorScheme == "Light")
{
ApplyPreviewBackground(lightBG);
mainWindow.Background = new SolidColorBrush(lightBG);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
return;
}
}
}
else if (Mode == "Dark")
{
mainWindow.Background = new SolidColorBrush(darkBG);
ApplyPreviewBackground(darkBG);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
return;
}
else if (Mode == "Light")
{
mainWindow.Background = new SolidColorBrush(lightBG);
ApplyPreviewBackground(lightBG);
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
return;
}
else
{
ApplyPreviewBackground(lightBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
} }
} }
public void ThemeModeColorforMica(string Mode) // ✅ DWM 다크 모드 적용
{ Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, useDarkMode ? 1 : 0);
var dict = GetThemeResourceDictionary(_settings.Theme); }, DispatcherPriority.Normal);
Color lightBG;
Color darkBG;
// get lightBG value. if not, get windowborderstyle's background.
try
{
lightBG = dict.Contains("lightBG") ? (Color)dict["lightBG"] : GetWindowBorderStyleBackground();
}
catch (Exception)
{
// if not lightBG, use windowborderstyle's background.
lightBG = GetWindowBorderStyleBackground();
} }
// get darkBG value, (if not, use lightBG)
try
{
darkBG = dict.Contains("darkBG") ? (Color)dict["darkBG"] : lightBG;
}
catch (Exception)
{
darkBG = lightBG; // if not darkBG, use lightBG
}
if (Mode == "Auto")
{
int themeValue = (int)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1);
string colorScheme = _settings.ColorScheme;
bool isDarkMode = themeValue == 0; // 0 is dark mode.
if (colorScheme == "System")
{
if (isDarkMode)
{
ApplyPreviewBackground(darkBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
return;
}
else
{
ApplyPreviewBackground(lightBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
return;
}
}
else
{
if (colorScheme == "Dark")
{
ApplyPreviewBackground(darkBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
return;
}
else if (colorScheme == "Light")
{
ApplyPreviewBackground(lightBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
return;
}
}
}
else if (Mode == "Dark")
{
ApplyPreviewBackground(darkBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
return;
}
else if (Mode == "Light")
{
ApplyPreviewBackground(lightBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
return;
}
else
{
ApplyPreviewBackground(lightBG);
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
}
}
public bool IsBlurTheme() public bool IsBlurTheme()
@ -604,11 +503,11 @@ namespace Flow.Launcher.Core.Resource
return false; return false;
} }
public string BlurMode() public string GetSystemBG()
{ {
if (Environment.OSVersion.Version >= new Version(6, 2)) if (Environment.OSVersion.Version >= new Version(6, 2))
{ {
var resource = Application.Current.TryFindResource("BlurMode"); var resource = Application.Current.TryFindResource("SystemBG");
if (resource is string) if (resource is string)
return (string)resource; return (string)resource;

View file

@ -193,6 +193,7 @@ namespace Flow.Launcher
{ {
ThemeManager.Instance.RefreshFrame(); ThemeManager.Instance.RefreshFrame();
}), DispatcherPriority.Background); }), DispatcherPriority.Background);
// MouseEventHandler // MouseEventHandler
PreviewMouseMove += MainPreviewMouseMove; PreviewMouseMove += MainPreviewMouseMove;
CheckFirstLaunch(); CheckFirstLaunch();

View file

@ -41,7 +41,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel
DropShadowEffect = true; DropShadowEffect = true;
OnPropertyChanged(nameof(IsDropShadowEnabled)); OnPropertyChanged(nameof(IsDropShadowEnabled));
ThemeManager.Instance.RefreshFrame(); ThemeManager.Instance.RefreshFrame();
//uThemeManager.Instance.SetBlurForWindow(); //ThemeManager.Instance.SetBlurForWindow();
} }
} }
public bool IsBackdropEnabled => SelectedTheme?.HasBlur ?? false; public bool IsBackdropEnabled => SelectedTheme?.HasBlur ?? false;

View file

@ -12,10 +12,10 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean> <system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Dark</system:String> <system:String x:Key="SystemBG">Dark</system:String>
<system:String x:Key="CornerType">DoNotRound</system:String> <system:String x:Key="CornerType">DoNotRound</system:String>
<Color x:Key="lightBG">#C7000000</Color> <Color x:Key="LightBG">#C7000000</Color>
<Color x:Key="darkBG">#C7000000</Color> <Color x:Key="DarkBG">#C7000000</Color>
<Style x:Key="WindowRadius" TargetType="{x:Type Border}"> <Style x:Key="WindowRadius" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="0" /> <Setter Property="CornerRadius" Value="0" />

View file

@ -11,10 +11,10 @@
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" /> <ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean> <system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Dark</system:String> <system:String x:Key="SystemBG">Dark</system:String>
<system:String x:Key="CornerType">DoNotRound</system:String> <system:String x:Key="CornerType">DoNotRound</system:String>
<Color x:Key="lightBG">#B0000000</Color> <Color x:Key="LightBG">#B0000000</Color>
<Color x:Key="darkBG">#B6000000</Color> <Color x:Key="DarkBG">#B6000000</Color>
<Style x:Key="WindowRadius" TargetType="{x:Type Border}"> <Style x:Key="WindowRadius" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="0" /> <Setter Property="CornerRadius" Value="0" />

View file

@ -11,10 +11,10 @@
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" /> <ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean> <system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Light</system:String> <system:String x:Key="SystemBG">Light</system:String>
<system:String x:Key="CornerType">DoNotRound</system:String> <system:String x:Key="CornerType">DoNotRound</system:String>
<Color x:Key="lightBG">#BFFAFAFA</Color> <Color x:Key="LightBG">#BFFAFAFA</Color>
<Color x:Key="darkBG">#BFFAFAFA</Color> <Color x:Key="DarkBG">#BFFAFAFA</Color>
<Style <Style
x:Key="ItemGlyph" x:Key="ItemGlyph"
BasedOn="{StaticResource BaseGlyphStyle}" BasedOn="{StaticResource BaseGlyphStyle}"

View file

@ -13,9 +13,9 @@
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" /> <ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean> <system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Auto</system:String> <system:String x:Key="SystemBG">Auto</system:String>
<Color x:Key="lightBG">#BFFAFAFA</Color> <Color x:Key="LightBG">#BFFAFAFA</Color>
<Color x:Key="darkBG">#BC202020</Color> <Color x:Key="DarkBG">#BC202020</Color>
<Style <Style
x:Key="ItemGlyph" x:Key="ItemGlyph"
BasedOn="{StaticResource BaseGlyphStyle}" BasedOn="{StaticResource BaseGlyphStyle}"

View file

@ -11,6 +11,10 @@
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" /> <ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">False</system:Boolean>
<system:String x:Key="SystemBG">Auto</system:String>
<Color x:Key="LightBG">#FFFAFAFA</Color>
<Color x:Key="DarkBG">#FF202020</Color>
<Thickness x:Key="ResultMargin">0 0 0 8</Thickness> <Thickness x:Key="ResultMargin">0 0 0 8</Thickness>
<Style <Style
x:Key="ItemGlyph" x:Key="ItemGlyph"

View file

@ -13,10 +13,10 @@
<ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" /> <ResourceDictionary Source="pack://application:,,,/Themes/Base.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean> <system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
<system:String x:Key="BlurMode">Auto</system:String> <system:String x:Key="SystemBG">Auto</system:String>
<system:String x:Key="CornerType">Round</system:String> <system:String x:Key="CornerType">Round</system:String>
<Color x:Key="lightBG">#BFFAFAFA</Color> <Color x:Key="LightBG">#BFFAFAFA</Color>
<Color x:Key="darkBG">#DD202020</Color> <Color x:Key="DarkBG">#DD202020</Color>
<Style <Style
x:Key="BulletStyle" x:Key="BulletStyle"
BasedOn="{StaticResource BaseBulletStyle}" BasedOn="{StaticResource BaseBulletStyle}"