Skip to content

Commit

Permalink
Windows 11 Notification Center Styler v1.1.1
Browse files Browse the repository at this point in the history
* Updated the TranslucentShell theme.
  • Loading branch information
m417z committed Jul 28, 2024
1 parent c372c5f commit a2c777e
Showing 1 changed file with 66 additions and 132 deletions.
198 changes: 66 additions & 132 deletions mods/windows-11-notification-center-styler.wh.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ==WindhawkMod==
// @id windows-11-notification-center-styler
// @name Windows 11 Notification Center Styler
// @description An advanced mod to override style attributes of the Notification Center
// @version 1.1
// @description Customize the Notification Center with themes contributed by others or create your own
// @version 1.1.1
// @author m417z
// @github https://github.com/m417z
// @twitter https://twitter.com/m417z
Expand All @@ -24,10 +24,8 @@
/*
# Windows 11 Notification Center Styler
An advanced mod to override style attributes of the notification center and
calendar. Starting with version 1.0.2, all elements that are part of
ShellExperienceHost.exe can be customized, including taskbar jump lists and
notification popups.
Customize the Notification Center with themes contributed by others or create
your own.
**Note**: This mod requires Windhawk v1.4 or later.
Expand Down Expand Up @@ -176,136 +174,72 @@ struct Theme {
std::vector<ThemeTargetStyles> targetStyles;
};

/*
JSON settings to C++ theme conversion code, quick'n'dirty & AI-generated:
json_str = R"""
{...}
"""
def json_to_cpp(json_data):
def cmp(x):
key_prefix = x[0].removeprefix("controlStyles[")
index1 = int(key_prefix.split("]")[0])
if ".target" in key_prefix:
index2 = -1
elif ".styles" in key_prefix:
index2 = int(key_prefix.split("[")[1].split("]")[0])
else:
assert False
return index1, index2
cpp_code = "{{\n"
for key, value in sorted(json_data.items(), key=cmp):
value_escaped = re.sub(
r'[^ -~]',
lambda m: f'\\u{ord(m[0]):04X}',
value.replace('"', '\\"'))
if ".target" in key:
if cpp_code != "{{\n":
cpp_code = cpp_code.removesuffix(", ")
cpp_code += "}},\n"
cpp_code += " ThemeTargetStyles{\n"
cpp_code += f" L\"{value_escaped}\",\n"
cpp_code += " {"
elif ".styles" in key:
cpp_code += f"L\"{value_escaped}\", "
else:
assert False
cpp_code = cpp_code.removesuffix(", ")
cpp_code += "}},\n"
cpp_code += "}};"
return cpp_code
json_input = json.loads(json_str)
cpp_output = json_to_cpp(json_input)
print(cpp_output)
*/
// clang-format off

// Author: Undisputed00x
const Theme g_themeTranslucentShell = {{
ThemeTargetStyles{L"Grid#NotificationCenterGrid",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0", L"CornerRadius=15"}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0", L"CornerRadius=15"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer",
{L"Background:=<AcrylicBrush Opacity=\"0\"/>"}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay",
{L"Background:=<AcrylicBrush Opacity=\"0\"/>"}},
ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > "
L"Grid#FocusGrid",
{L"Background:=<AcrylicBrush Opacity=\"0\"/>"}},
ThemeTargetStyles{
L"MenuFlyoutPresenter",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0", L"CornerRadius=15", L"Padding=2,4,2,4"}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0", L"CornerRadius=15",
L"Margin=-2,-2,-2,-2"}},
ThemeTargetStyles{L"Grid#ControlCenterRegion",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0", L"CornerRadius=15"}},
ThemeTargetStyles{
L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0", L"CornerRadius=15"}},
ThemeTargetStyles{
L"Grid#MediaTransportControlsRoot",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"ContentPresenter#PageContent",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"ContentPresenter#PageContent > Grid > Border",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > "
L"ContentPresenter > Grid#FullScreenPageRoot",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > "
L"ContentPresenter > Grid#FullScreenPageRoot > "
L"ContentPresenter#PageHeader",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"ScrollViewer#ListContent",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{
L"ActionCenter.FlexibleToastView#FlexibleNormalToastView",
{L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"Border#ToastBackgroundBorder2",
{L"Background:=<AcrylicBrush TintOpacity=\"0\" "
L"TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" "
L"Opacity=\"1\"/>",
L"BorderThickness=0,0,0,0"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem > Grid#LayoutRoot > "
L"Border#BackgroundBorder",
{L"FocusVisualPrimaryThickness=0,0,0,0",
L"FocusVisualSecondaryThickness=0,0,0,0"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Grid#LayoutRoot > "
L"Border#BackgroundBorder",
{L"FocusVisualPrimaryThickness=0,0,0,0"}},
ThemeTargetStyles{L"Grid#NotificationCenterGrid", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", {
L"Background:=<AcrylicBrush Opacity=\"0\"/>"}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", {
L"Background:=<AcrylicBrush Opacity=\"0\"/>"}},
ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > Grid#FocusGrid", {
L"Background:=<AcrylicBrush Opacity=\"0\"/>"}},
ThemeTargetStyles{L"MenuFlyoutPresenter", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15",
L"Padding=2,4,2,4"}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15",
L"Margin=-2,-2,-2,-2"}},
ThemeTargetStyles{L"Grid#ControlCenterRegion", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRoot", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"ContentPresenter#PageContent", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"ContentPresenter#PageContent > Grid > Border", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot > ContentPresenter#PageHeader", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"ScrollViewer#ListContent", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"ActionCenter.FlexibleToastView#FlexibleNormalToastView", {
L"Background:=<SolidColorBrush Color=\"Transparent\"/>"}},
ThemeTargetStyles{L"Border#ToastBackgroundBorder2", {
L"Background:=<AcrylicBrush TintOpacity=\"0\" TintColor=\"Transparent\" TintLuminosityOpacity=\"0\" Opacity=\"1\" FallbackColor=\"#70262626\"/>",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"FocusVisualPrimaryThickness=0,0,0,0",
L"FocusVisualSecondaryThickness=0,0,0,0"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"FocusVisualPrimaryThickness=0,0,0,0"}},
ThemeTargetStyles{L"ActionCenter.FlexibleItemView", {
L"CornerRadius=15"}},
}};

// clang-format on

std::atomic<bool> g_initialized;
thread_local bool g_initializedForThread;

Expand Down

0 comments on commit a2c777e

Please sign in to comment.