diff --git a/mods/windows-11-notification-center-styler.wh.cpp b/mods/windows-11-notification-center-styler.wh.cpp index 7be965a46..671471d9e 100644 --- a/mods/windows-11-notification-center-styler.wh.cpp +++ b/mods/windows-11-notification-center-styler.wh.cpp @@ -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 @@ -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. @@ -176,136 +174,72 @@ struct Theme { std::vector 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:=", - L"BorderThickness=0,0,0,0", L"CornerRadius=15"}}, - ThemeTargetStyles{L"Grid#CalendarCenterGrid", - {L"Background:=", - L"BorderThickness=0,0,0,0", L"CornerRadius=15"}}, - ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", - {L"Background:="}}, - ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", - {L"Background:="}}, - ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > " - L"Grid#FocusGrid", - {L"Background:="}}, - ThemeTargetStyles{ - L"MenuFlyoutPresenter", - {L"Background:=", - L"BorderThickness=0,0,0,0", L"CornerRadius=15", L"Padding=2,4,2,4"}}, - ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", - {L"Background:=", - L"BorderThickness=0,0,0,0", L"CornerRadius=15", - L"Margin=-2,-2,-2,-2"}}, - ThemeTargetStyles{L"Grid#ControlCenterRegion", - {L"Background:=", - L"BorderThickness=0,0,0,0", L"CornerRadius=15"}}, - ThemeTargetStyles{ - L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border", - {L"Background:="}}, - ThemeTargetStyles{ - L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", - {L"Background:=", - L"BorderThickness=0,0,0,0", L"CornerRadius=15"}}, - ThemeTargetStyles{ - L"Grid#MediaTransportControlsRoot", - {L"Background:="}}, - ThemeTargetStyles{ - L"ContentPresenter#PageContent", - {L"Background:="}}, - ThemeTargetStyles{ - L"ContentPresenter#PageContent > Grid > Border", - {L"Background:="}}, - ThemeTargetStyles{ - L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > " - L"ContentPresenter > Grid#FullScreenPageRoot", - {L"Background:="}}, - ThemeTargetStyles{ - L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > " - L"ContentPresenter > Grid#FullScreenPageRoot > " - L"ContentPresenter#PageHeader", - {L"Background:="}}, - ThemeTargetStyles{ - L"ScrollViewer#ListContent", - {L"Background:="}}, - ThemeTargetStyles{ - L"ActionCenter.FlexibleToastView#FlexibleNormalToastView", - {L"Background:="}}, - ThemeTargetStyles{L"Border#ToastBackgroundBorder2", - {L"Background:=", - 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:=", + L"BorderThickness=0,0,0,0", + L"CornerRadius=15"}}, + ThemeTargetStyles{L"Grid#CalendarCenterGrid", { + L"Background:=", + L"BorderThickness=0,0,0,0", + L"CornerRadius=15"}}, + ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", { + L"Background:="}}, + ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", { + L"Background:="}}, + ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > Grid#FocusGrid", { + L"Background:="}}, + ThemeTargetStyles{L"MenuFlyoutPresenter", { + L"Background:=", + L"BorderThickness=0,0,0,0", + L"CornerRadius=15", + L"Padding=2,4,2,4"}}, + ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", { + L"Background:=", + L"BorderThickness=0,0,0,0", + L"CornerRadius=15", + L"Margin=-2,-2,-2,-2"}}, + ThemeTargetStyles{L"Grid#ControlCenterRegion", { + L"Background:=", + L"BorderThickness=0,0,0,0", + L"CornerRadius=15"}}, + ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border", { + L"Background:="}}, + ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", { + L"Background:=", + L"BorderThickness=0,0,0,0", + L"CornerRadius=15"}}, + ThemeTargetStyles{L"Grid#MediaTransportControlsRoot", { + L"Background:="}}, + ThemeTargetStyles{L"ContentPresenter#PageContent", { + L"Background:="}}, + ThemeTargetStyles{L"ContentPresenter#PageContent > Grid > Border", { + L"Background:="}}, + ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot", { + L"Background:="}}, + ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot > ContentPresenter#PageHeader", { + L"Background:="}}, + ThemeTargetStyles{L"ScrollViewer#ListContent", { + L"Background:="}}, + ThemeTargetStyles{L"ActionCenter.FlexibleToastView#FlexibleNormalToastView", { + L"Background:="}}, + ThemeTargetStyles{L"Border#ToastBackgroundBorder2", { + L"Background:=", + 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 g_initialized; thread_local bool g_initializedForThread;