diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs
index 9d937b51b1..87c3406357 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.ThemeBlurEnabled = (bool)Application.Current.Resources["ThemeBlurEnabled"];
+ 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..7aa48a82df 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 bool ThemeBlurEnabled { 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 4a0223a19e..6bd64615ee 100644
--- a/Wox/Helper/WindowIntelopHelper.cs
+++ b/Wox/Helper/WindowIntelopHelper.cs
@@ -88,5 +88,75 @@ namespace Wox.Helper
public int Right;
public int Bottom;
}
+
+ #region Blur Handling
+ /*
+ Found on https://github.com/riverar/sample-win10-aeroglass
+ */
+ public enum AccentState
+ {
+ ACCENT_DISABLED = 0,
+ ACCENT_ENABLE_GRADIENT = 1,
+ ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
+ ACCENT_ENABLE_BLURBEHIND = 3,
+ ACCENT_INVALID_STATE = 4
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct AccentPolicy
+ {
+ public AccentState AccentState;
+ public int AccentFlags;
+ public int GradientColor;
+ public int AnimationId;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct WindowCompositionAttributeData
+ {
+ public WindowCompositionAttribute Attribute;
+ public IntPtr Data;
+ public int SizeOfData;
+ }
+
+ internal enum WindowCompositionAttribute
+ {
+ WCA_ACCENT_POLICY = 19
+ }
+ [DllImport("user32.dll")]
+ private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
+
+ ///
+ /// Sets the blur for a window via SetWindowCompositionAttribute
+ ///
+ /// window to blur
+ /// true/false - on or off correspondingly
+ public static void SetBlurForWindow(Window wind, bool status)
+ {
+ SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED);
+ }
+
+ private static void SetWindowAccent(Window wind, AccentState themeAccentMode)
+ {
+ var windowHelper = new WindowInteropHelper(wind);
+ var accent = new AccentPolicy();
+ accent.AccentState = themeAccentMode;
+ var accentStructSize = Marshal.SizeOf(accent);
+
+ var accentPtr = Marshal.AllocHGlobal(accentStructSize);
+ Marshal.StructureToPtr(accent, accentPtr, false);
+
+ var data = new WindowCompositionAttributeData();
+ data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
+ data.SizeOfData = accentStructSize;
+ data.Data = accentPtr;
+
+ SetWindowCompositionAttribute(windowHelper.Handle, ref data);
+
+ Marshal.FreeHGlobal(accentPtr);
+ }
+ #endregion
+
+
}
}
\ No newline at end of file
diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml
index 71b8cccf6a..8f53a74ff0 100644
--- a/Wox/Languages/en.xaml
+++ b/Wox/Languages/en.xaml
@@ -43,6 +43,8 @@
Result Item Font
Window Mode
Opacity
+ Windows Accents
+
Hotkey
diff --git a/Wox/Languages/ru.xaml b/Wox/Languages/ru.xaml
index 13a7be86cc..0c25bfb5a2 100644
--- a/Wox/Languages/ru.xaml
+++ b/Wox/Languages/ru.xaml
@@ -43,6 +43,7 @@
Шрифт результатов
Оконный режим
Прозрачность
+ Windows Accents
Горячие клавиши
diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml
index 0823b5f3e0..8db385c98d 100644
--- a/Wox/Languages/zh-cn.xaml
+++ b/Wox/Languages/zh-cn.xaml
@@ -43,7 +43,8 @@
结果项字体
窗口模式
透明度
-
+ Windows Accents
+
热键
Wox激活热键
diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml
index 5d8907fe7a..780bc115a5 100644
--- a/Wox/Languages/zh-tw.xaml
+++ b/Wox/Languages/zh-tw.xaml
@@ -43,6 +43,7 @@
結果項字體
窗口模式
透明度
+ Windows Accents
熱鍵
diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml
index 4b5a315fed..e3f249642e 100644
--- a/Wox/MainWindow.xaml
+++ b/Wox/MainWindow.xaml
@@ -13,7 +13,9 @@
AllowDrop="True"
ShowInTaskbar="False"
Style="{DynamicResource WindowStyle}"
- Icon="Images\app.png">
+ Icon="Images\app.png"
+ AllowsTransparency="True"
+ >
diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs
index 5a289131ed..8be83c06a7 100644
--- a/Wox/MainWindow.xaml.cs
+++ b/Wox/MainWindow.xaml.cs
@@ -255,6 +255,7 @@ namespace Wox
InitProgressbarAnimation();
WindowIntelopHelper.DisableControlBox(this);
+ WindowIntelopHelper.SetBlurForWindow(this, UserSettingStorage.Instance.ThemeBlurEnabled);
CheckUpdate();
}
diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs
index 4546d8f797..c484adbeb0 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.SetBlurForWindow(MainWindow, UserSettingStorage.Instance.ThemeBlurEnabled);
}, TimeSpan.FromMilliseconds(100));
}
diff --git a/Wox/Themes/Base.xaml b/Wox/Themes/Base.xaml
index 39866e052c..5fa7c96c81 100644
--- a/Wox/Themes/Base.xaml
+++ b/Wox/Themes/Base.xaml
@@ -27,6 +27,10 @@
+
+ false
+
+
+
+
diff --git a/Wox/Themes/SimpleBlur-Black.xaml b/Wox/Themes/SimpleBlur-Black.xaml
new file mode 100644
index 0000000000..88e911b931
--- /dev/null
+++ b/Wox/Themes/SimpleBlur-Black.xaml
@@ -0,0 +1,54 @@
+
+
+
+
+
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #356ef3
+
+
+
+
+
+
diff --git a/Wox/Themes/SimpleBlur-White.xaml b/Wox/Themes/SimpleBlur-White.xaml
new file mode 100644
index 0000000000..132f93333d
--- /dev/null
+++ b/Wox/Themes/SimpleBlur-White.xaml
@@ -0,0 +1,54 @@
+
+
+
+
+
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #356ef3
+
+
+
+
+
+
diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj
index 3275ed7398..e2e9bcb450 100644
--- a/Wox/Wox.csproj
+++ b/Wox/Wox.csproj
@@ -258,6 +258,16 @@
Designer
PreserveNewest
+
+ MSBuild:Compile
+ Designer
+ PreserveNewest
+
+
+ MSBuild:Compile
+ Designer
+ PreserveNewest
+
Designer
MSBuild:Compile