diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index 9d937b51b1..e9eee2e0fa 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -53,10 +53,11 @@ namespace Wox.Core.Theme } } - UserSettingStorage.Instance.Theme = themeName; - UserSettingStorage.Instance.Save(); - ResourceMerger.ApplyThemeResource(this); + + UserSettingStorage.Instance.Theme = themeName; + UserSettingStorage.Instance.ThemeAccentMode = (int)Application.Current.Resources["WindowsAccentMode"]; + UserSettingStorage.Instance.Save(); } public ResourceDictionary GetResourceDictionary() @@ -89,7 +90,6 @@ namespace Wox.Core.Theme Setter[] setters = new Setter[] { fontFamily, fontStyle, fontWeight, fontStretch }; Array.ForEach(new Style[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } - return dict; } diff --git a/Wox.Core/UserSettings/UserSettingStorage.cs b/Wox.Core/UserSettings/UserSettingStorage.cs index 32b3a20cc7..1b9f69396c 100644 --- a/Wox.Core/UserSettings/UserSettingStorage.cs +++ b/Wox.Core/UserSettings/UserSettingStorage.cs @@ -55,6 +55,9 @@ namespace Wox.Core.UserSettings [JsonProperty] public string ResultItemFontStretch { get; set; } + [JsonProperty] + public int ThemeAccentMode { get; set; } + [JsonProperty] public double WindowLeft { get; set; } @@ -117,6 +120,8 @@ namespace Wox.Core.UserSettings get { return "config"; } } + + public void IncreaseActivateTimes() { ActivateTimes++; diff --git a/Wox/Helper/WindowIntelopHelper.cs b/Wox/Helper/WindowIntelopHelper.cs index a9dd5ab217..fd40479eca 100644 --- a/Wox/Helper/WindowIntelopHelper.cs +++ b/Wox/Helper/WindowIntelopHelper.cs @@ -121,13 +121,13 @@ namespace Wox.Helper } [DllImport("user32.dll")] internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); - public static void EnableBlur(Window wind) + public static void SetWindowAccent(Window wind, int themeAccentMode) { + if (themeAccentMode < 0 || themeAccentMode > 3) + themeAccentMode = 0; var windowHelper = new WindowInteropHelper(wind); - var accent = new AccentPolicy(); - accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; - accent.GradientColor = 16711680; + accent.AccentState = (AccentState) themeAccentMode; var accentStructSize = Marshal.SizeOf(accent); var accentPtr = Marshal.AllocHGlobal(accentStructSize); diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 4546d8f797..0d8bf200ac 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -460,6 +460,7 @@ namespace Wox Dispatcher.DelayInvoke("delayChangeTheme", () => { ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); + WindowIntelopHelper.SetWindowAccent(MainWindow, UserSettingStorage.Instance.ThemeAccentMode); }, TimeSpan.FromMilliseconds(100)); } diff --git a/Wox/Themes/Base.xaml b/Wox/Themes/Base.xaml index d0d2b4a8eb..18d1edcb4e 100644 --- a/Wox/Themes/Base.xaml +++ b/Wox/Themes/Base.xaml @@ -27,7 +27,10 @@ + 0 + + + + diff --git a/Wox/Themes/SimpleBlur.xaml b/Wox/Themes/SimpleBlur.xaml index fb8882dd33..ff136a15d2 100644 --- a/Wox/Themes/SimpleBlur.xaml +++ b/Wox/Themes/SimpleBlur.xaml @@ -5,6 +5,9 @@ + + 3 + diff --git a/Wox/Themes/Test.xaml b/Wox/Themes/Test.xaml index 108852a6f5..70bc4aedd5 100644 --- a/Wox/Themes/Test.xaml +++ b/Wox/Themes/Test.xaml @@ -5,8 +5,11 @@ + + 3 + - #FFBBBBBB + Transparent