// ==WindhawkMod==
// @id windows-11-notification-center-styler
// @name Windows 11 Notification Center Styler
// @description Customize the Notification Center and Action Center with themes contributed by others or create your own
// @version 1.3.3
// @author m417z
// @github https://github.com/m417z
// @twitter https://twitter.com/m417z
// @homepage https://m417z.com/
// @include ShellExperienceHost.exe
// @include ShellHost.exe
// @architecture x86-64
// @compilerOptions -lcomctl32 -lole32 -loleaut32 -lruntimeobject -Wl,--export-all-symbols
// ==/WindhawkMod==
// Source code is published under The GNU General Public License v3.0.
//
// For bug reports and feature requests, please open an issue here:
// https://github.com/ramensoftware/windhawk-mods/issues
//
// For pull requests, development takes place here:
// https://github.com/m417z/my-windhawk-mods
// ==WindhawkModReadme==
/*
# Windows 11 Notification Center Styler
Customize the Notification Center and Action Center with themes contributed by
others or create your own.
Also check out the **Windows 11 Taskbar Styler**, **Windows 11 Start Menu
Styler** mods.
## Themes
Themes are collections of styles. The following themes are integrated into the
mod and can be selected in the settings:
[
\
TranslucentShell](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/Themes/TranslucentShell/README.md)
[
\
Matter](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/Themes/Matter/README.md)
[
\
Unified](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/Themes/Unified/README.md)
[
\
10JumpLists](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/Themes/10JumpLists/README.md)
[
\
WindowGlass](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/Themes/WindowGlass/README.md)
[
\
Oversimplified&Accentuated](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/Themes/Oversimplified&Accentuated/README.md)
More themes can be found in the **Themes** section of [The Windows 11
notification center styling
guide](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/README.md#themes).
Contributions of new themes are welcome!
## Advanced styling
Aside from themes, the settings have two sections: control styles and resource
variables. Control styles allow to override styles, such as size and color, for
the target elements. Resource variables allow to override predefined variables.
For a more detailed explanation and examples, refer to the sections below.
The [UWPSpy](https://ramensoftware.com/uwpspy) tool can be used to inspect the
notification center control elements in real time, and experiment with various
styles.
For a collection of commonly requested notification center styling
customizations, check out [The Windows 11 notification center styling
guide](https://github.com/ramensoftware/windows-11-notification-center-styling-guide/blob/main/README.md).
### Control styles
Each entry has a target control and a list of styles.
The target control is written as `Class` or `Class#Name`, i.e. the target
control class name (the tag name in XAML resource files), such as
`ActionCenter.FocusSessionControl` or `Rectangle`, optionally followed by `#`
and the target control's name (`x:Name` attribute in XAML resource files). The
target control can also include:
* Child control index, for example: `Class#Name[2]` will only match the relevant
control that's also the second child among all of its parent's child controls.
* Control properties, for example:
`Class#Name[Property1=Value1][Property2=Value2]`.
* Parent controls, separated by `>`, for example: `ParentClass#ParentName >
Class#Name`.
* Visual state group name, for example: `Class#Name@VisualStateGroupName`. It
can be specified for the target control or for a parent control, but can be
specified only once per target. The visual state group can be used in styles
as specified below.
**Note**: The target is evaluated only once. If, for example, the index or the
properties of a control change, the target conditions aren't evaluated again.
Each style is written as `Style=Value`, for example: `Height=5`. The `:=` syntax
can be used to use XAML syntax, for example: `Fill:=`. Specifying an empty value with the XAML syntax will clear the
property value, for example: `Fill:=`. In addition, a visual state can be
specified as following: `Style@VisualState=Value`, in which case the style will
only apply when the visual state group specified in the target matches the
specified visual state.
For the XAML syntax, in addition to the built-in taskbar objects, the mod
provides a built-in blur brush via the `WindhawkBlur` object, which supports the
`BlurAmount`, `TintColor`, and `TintOpacity` properties. For example:
`Fill:=`. Theme resources
are also supported, for example: `Fill:=`.
Targets and styles starting with two slashes (`//`) are ignored. This can be
useful for temporarily disabling a target or style.
A couple of practical examples:
#### Hide the focus assist section
**Target**: `ActionCenter.FocusSessionControl` \
**Style**: `Height=0`
#### Hide the notification center
**Target**: `Grid#NotificationCenterGrid` \
**Style**: `Visibility=Collapsed`
#### Shrink the notification center height
Makes panel non full-height when there are fewer notifications (fit to size). \
**Target**: `Grid#NotificationCenterGrid` \
**Style**: `VerticalAlignment=2`
#### Square the corners of the notification center
**Target**: `Grid#NotificationCenterGrid` \
**Style**: `CornerRadius=0`
#### Square the corners of the calendar
**Target**: `Grid#CalendarCenterGrid` \
**Style**: `CornerRadius=0`
#### Square the corners of the quick action center
**Target**: `Grid#ControlCenterRegion` \
**Style**: `CornerRadius=0`
#### Calendar and notification titlebars: titles on the right, buttons on the left
**Target**: `Grid#RootContent` \
**Style**: `FlowDirection=1`
#### Add accelerator key (ALT+X) to clear all notifications
**Target**: `Windows.UI.Xaml.Controls.Button#ClearAll` \
**Style**: `AccessKey=x`
#### Add accelerator key (ALT+E) to expand/collapse the calendar
**Target**: `Windows.UI.Xaml.Controls.Button#ExpandCollapseButton` \
**Style**: `AccessKey=e`
### Resource variables
Some variables, such as size and padding for various controls, are defined as
resource variables.
## Implementation notes
The VisualTreeWatcher implementation is based on the
[ExplorerTAP](https://github.com/TranslucentTB/TranslucentTB/tree/develop/ExplorerTAP)
code from the **TranslucentTB** project.
The `WindhawkBlur` brush object implementation is based on
[XamlBlurBrush](https://github.com/TranslucentTB/TranslucentTB/blob/release/ExplorerTAP/XamlBlurBrush.cpp)
from the **TranslucentTB** project.
*/
// ==/WindhawkModReadme==
// ==WindhawkModSettings==
/*
- theme: ""
$name: Theme
$description: >-
Themes are collections of styles. For details about the themes below, or for
information about submitting your own theme, refer to the relevant section
in the mod details.
$options:
- "": None
- TranslucentShell: TranslucentShell
- Matter: Matter
- Unified: Unified
- 10JumpLists: 10JumpLists
- WindowGlass: WindowGlass
- WindowGlass_variant_alternative: WindowGlass (Alternative)
- Oversimplified&Accentuated: Oversimplified&Accentuated
- controlStyles:
- - target: ""
$name: Target
- styles: [""]
$name: Styles
$name: Control styles
- styleConstants: [""]
$name: Style constants
$description: >-
Constants which can be defined once and used in multiple styles.
Each entry contains a style name and value, separated by '=', for example:
mainColor=#fafad2
The constant can then be used in style definitions by prepending '$', for
example:
Fill=$mainColor
Background:=
- resourceVariables:
- - variableKey: ""
$name: Variable key
- value: ""
$name: Value
$name: Resource variables
*/
// ==/WindhawkModSettings==
#include
#include
#include
#undef GetCurrentTime
#include
struct ThemeTargetStyles {
PCWSTR target;
std::vector styles;
};
struct Theme {
std::vector targetStyles;
std::vector styleConstants;
};
// clang-format off
const Theme g_themeTranslucentShell = {{
ThemeTargetStyles{L"Grid#NotificationCenterGrid", {
L"Background:=$CommonBgBrush",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid", {
L"Background:=$CommonBgBrush",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", {
L"Background=Transparent"}},
ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > Grid#FocusGrid", {
L"Background=Transparent"}},
ThemeTargetStyles{L"MenuFlyoutPresenter > Border", {
L"Background:=",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15",
L"Padding=2,4,2,4"}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", {
L"Background:=$CommonBgBrush",
L"BorderThickness=0,0,0,0",
L"CornerRadius=15",
L"Margin=-2,-2,-2,-2"}},
ThemeTargetStyles{L"Grid#ControlCenterRegion", {
L"Background:=$CommonBgBrush",
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:=$CommonBgBrush",
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:=$CommonBgBrush",
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"}},
ThemeTargetStyles{L"ControlCenter.MediaTransportControls#MediaTransportControls > Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", {
L"Height=470"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#AlbumTextAndArtContainer", {
L"Height=350"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ThumbnailImage", {
L"Width=300",
L"Height=300",
L"HorizontalAlignment=Center",
L"VerticalAlignment=Top",
L"Grid.Column=1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ThumbnailImage > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer", {
L"VerticalAlignment=Bottom",
L"Grid.Column=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#TitleText", {
L"TextAlignment=Center"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#SubtitleText", {
L"TextAlignment=Center"}},
}, {
L"CommonBgBrush=",
}};
const Theme g_themeMatter = {{
ThemeTargetStyles{L"Grid#NotificationCenterGrid", {
L"Background:=$base",
L"BorderThickness=0,0,0,0",
L"CornerRadius=$r1",
L"Shadow :="}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid", {
L"Background:=$base",
L"BorderThickness=0,0,0,0",
L"CornerRadius=$r1",
L"Shadow :=",
L"Margin = 0,6,0,6",
L"MinHeight = 40"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=-10,11,-10,-14",
L"Shadow :="}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Shadow :=",
L"Margin =-10,-6,-10,-8",
L"Height = 45"}},
ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > Grid#FocusGrid", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=6,7,6,6",
L"Shadow :="}},
ThemeTargetStyles{L"MenuFlyoutPresenter", {
L"Background:=$base",
L"BorderThickness=0,0,0,0",
L"CornerRadius=$r3",
L"Padding=1,2,1,2",
L"Shadow :="}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", {
L"Background:=$base",
L"BorderThickness=0,0,0,0",
L"CornerRadius=$r3",
L"Margin=-2,-2,-2,-2",
L"Shadow :="}},
ThemeTargetStyles{L"Grid#ControlCenterRegion", {
L"Background:=$base",
L"CornerRadius=$r1",
L"BorderThickness=0,0,0,0",
L"Shadow :=",
L"Margin = 0,0,0,-6"}},
ThemeTargetStyles{L"ContentPresenter#PageContent", {
L"Background:= $transparent",
L"Shadow :="}},
ThemeTargetStyles{L"ContentPresenter#PageContent > Grid > Border", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=8,0,8,2",
L"Shadow :="}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot", {
L"Background:= $transparent",
L"Shadow :="}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot > ContentPresenter#PageHeader", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=7,7,7,7",
L"Shadow :="}},
ThemeTargetStyles{L"ScrollViewer#ListContent", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=8,0,8,0",
L"Shadow :="}},
ThemeTargetStyles{L"ActionCenter.FlexibleToastView#FlexibleNormalToastView", {
L"Background:= $transparent",
L"Shadow :="}},
ThemeTargetStyles{L"Border#ToastBackgroundBorder2", {
L"Background:=$base",
L"BorderThickness=0,0,0,0",
L"CornerRadius=16",
L"Shadow :="}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"Background:=$overlay",
L"CornerRadius=8"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"CornerRadius=6"}},
ThemeTargetStyles{L"ActionCenter.FlexibleItemView", {
L"CornerRadius=16",
L"Shadow :="}},
ThemeTargetStyles{L"QuickActions.AccessibleToggleButton#ToggleButton", {
L"CornerRadius=13",
L"BorderThickness = 0"}},
ThemeTargetStyles{L"QuickActions.AccessibleToggleButton#SplitL2Button", {
L"CornerRadius =13",
L"Margin=4,0,-4,0",
L"BorderThickness = 0"}},
ThemeTargetStyles{L"Grid#NotificationCenterTopBanner", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=6"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter", {
L"BorderThickness=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#FooterButton[AutomationProperties.Name = Edit quick settings]", {
L"Margin = 0,0,8,0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button[AutomationProperties.AutomationId = Microsoft.QuickAction.Battery]", {
L"Margin = 2,0,0,0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#FooterButton[AutomationProperties.Name = All settings]", {
L"Margin = 0,0,-1,0",
L"CornerRadius = 13"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button[AutomationProperties.AutomationId = Microsoft.QuickAction.Volume]", {
L"CornerRadius = 10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#VolumeL2Button[AutomationProperties.Name = Select a sound output]", {
L"CornerRadius = 10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#HorizontalTrackRect", {
L"Height = 10",
L"Fill := $overlay",
L"RadiusY = 3",
L"RadiusX = 3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#HorizontalDecreaseRect", {
L"Height =10",
L"RadiusY = 3",
L"RadiusX = 3",
L"Margin = 0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb", {
L"Visibility = 1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", {
L"Height=470",
L"CornerRadius=$r1",
L"BorderThickness = 0",
L"Background:=$base",
L"Shadow :=",
L"Margin = 0,0,0,12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#AlbumTextAndArtContainer", {
L"Height=347"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ThumbnailImage", {
L"Width=300",
L"Height=300",
L"HorizontalAlignment=Center",
L"VerticalAlignment=Top",
L"Grid.Column=1",
L"Margin=0,2,0,0",
L"CornerRadius=$r2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer", {
L"VerticalAlignment=Bottom",
L"Margin = 0,5,0,-5"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#Title", {
L"TextAlignment=Center",
L"FontFamily = Tektur",
L"FontSize = 18"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#Subtitle", {
L"TextAlignment=Center",
L"FontFamily = Montserrat",
L"Margin = 0,3,0,0",
L"FontWeight= 600"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListView#MediaButtonsListView", {
L"VerticalAlignment=Top",
L"Height=48",
L"Margin = 0,12,0,-12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#PreviousButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Background@Normal:=$overlay",
L"Background@PointerOver:=$accentColor",
L"Background@Pressed:=$overlay2",
L"Width=40",
L"Height= 30",
L"CornerRadius = 6",
L"Margin = 15,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PlayPauseButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Background@Normal:=$overlay",
L"Background@PointerOver:=$accentColor",
L"Background@Pressed:=$overlay2",
L"Width=40",
L"Height = 40",
L"CornerRadius = 8",
L"Margin = -10,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#NextButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Background@Normal:=$overlay",
L"Background@PointerOver:=$accentColor",
L"Background@Pressed:=$overlay2",
L"Width=40",
L"Height = 30",
L"CornerRadius = 6",
L"Margin = -20,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.TextBlock#AppNameText", {
L"FontFamily = Tektur",
L"FontSize = 16"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Image#IconImage", {
L"Height = 20",
L"Width = 20"}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRoot", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"Grid#ToastPeekRegion", {
L"Background =",
L"RenderTransform:=",
L"Grid.Column = 0",
L"Grid.Row = 2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius = 8",
L"Margin = 1,2,1,2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem", {
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Control > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarViewItem", {
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListViewHeaderItem", {
L"Margin = 50,6,50,2",
L"CornerRadius = 8",
L"Height = 35"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#SettingsButton", {
L"CornerRadius = 4"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#DismissButton", {
L"CornerRadius = 4"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#CalendarHeader", {
L"Margin = 6,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ScrollContentPresenter#ScrollContentPresenter", {
L"Margin = 1,2,1,2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#WeekDayNames", {
L"Background := ",
L"CornerRadius = 8",
L"Margin = 4,0,4,0",
L"Padding = 0,-5,0,-3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListViewItem", {
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#RootGrid > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"Background := ",
L"BorderThickness = 0",
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.Border#ItemOpaquePlating", {
L"Background := $overlay2",
L"BorderThickness = 0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#StandardHeroContainer", {
L"Margin = 12,0,12,0",
L"CornerRadius = 0",
L"Height = 150"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.ScrollBar#VerticalScrollBar", {
L"Visibility = 1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#SliderContainer", {
L"Margin = 0-2,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#BackButton", {
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#OuterBorder", {
L"RadiusX = 6",
L"RadiusY = 6",
L"Height = 18"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#SwitchKnobOff", {
L"RadiusY = 3",
L"RadiusX = 3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Border#SwitchKnobOn", {
L"CornerRadius = 3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#SwitchKnobBounds", {
L"RadiusX = 6",
L"RadiusY = 6",
L"Height = 18"}},
ThemeTargetStyles{L"ActionCenter.NotificationListViewItem", {
L"Margin = 5,2,5,3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid[AutomationProperties.LocalizedLandmarkType = Footer]", {
L"BorderThickness = 0"}},
ThemeTargetStyles{L"NetworkUX.View.SettingsListViewItem > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root", {
L"CornerRadius = 12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter > Windows.UI.Xaml.Controls.Border", {
L"BorderThickness = 0"}},
ThemeTargetStyles{L"Button#ClearAll", {
L"AccessKey=x"}},
ThemeTargetStyles{L"Button#ExpandCollapseButton", {
L"AccessKey=e"}},
}, {
L"transparent = ",
L"base = ",
L"overlay = ",
L"accentColor =",
L"overlay2 = ",
L"r1 = 18",
L"r2 = 14",
L"r3 = 12",
}};
const Theme g_themeUnified = {{
ThemeTargetStyles{L"ActionCenter.FocusSessionControl", {
L"Height=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#CalendarCenterGrid", {
L"CornerRadius=0,0,6,6",
L"Margin=0,0,0,12",
L"BorderThickness=1,0,1,1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#NotificationCenterGrid", {
L"CornerRadius=6,6,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", {
L"CornerRadius=6,6,0,0",
L"BorderThickness=1,1,1,0",
L"Margin=0,0,0,-6"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Border#CalendarHeaderMinimizedOverlay", {
L"Visibility=Visible"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ScrollViewer#CalendarControlScrollViewer", {
L"BorderThickness=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter", {
L"BackgroundTransition:="}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > Windows.UI.Xaml.Controls.Border", {
L"BackgroundTransition:="}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ComboBox > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.Border", {
L"BackgroundTransition:="}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem > Windows.UI.Xaml.Controls.Border", {
L"BackgroundTransition:="}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Control > Windows.UI.Xaml.Controls.Border", {
L"BackgroundTransition:="}},
}};
const Theme g_theme10JumpLists = {{
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#JumpListGrid", {
L"Margin=0,0,0,0",
L"CornerRadius=0",
L"Width=256"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Border#JumpListRestyledAcrylic", {
L"CornerRadius=0",
L"Background=Transparent",
L"BorderThickness=0,0,0,0"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListView#SystemItemList", {
L"Width=256"}},
ThemeTargetStyles{L"JumpViewUI.TaskbarJumpListFrame", {
L"Width=256"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListView#ItemList", {
L"Width=256",
L"Padding=0,5,0,5"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemControl > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.TextBlock", {
L"FontFamily=Segoe MDL2 Assets"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PinButton > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter > Windows.UI.Xaml.Controls.TextBlock", {
L"FontFamily=Segoe MDL2 Assets"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PinButton", {
L"Width=30",
L"Height=30"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem", {
L"Margin=0,0,0,0",
L"Height=30"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem", {
L"Margin=0,0,0,0",
L"Height=30"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem > Windows.UI.Xaml.Controls.Grid#LayoutRoot@CommonStates > Windows.UI.Xaml.Controls.Border#BackgroundBorder", {
L"CornerRadius=0",
L"Background@PointerOver:=",
L"Background@Pressed:=",
L"BorderBrush@PointerOver:=",
L"BorderBrush@Pressed:=",
L"BorderThickness=1,1,1,1"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Windows.UI.Xaml.Controls.Grid#LayoutRoot@CommonStates > Windows.UI.Xaml.Controls.Border#BackgroundBorder", {
L"CornerRadius=0",
L"Background@PointerOver:=",
L"Background@Pressed:=",
L"BorderBrush@PointerOver:=",
L"BorderBrush@Pressed:=",
L"BorderThickness=1,1,1,1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PinButton > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Shapes.Rectangle", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.TextBlock#DisplayNameTextBlock", {
L"FontSize=12",
L"FontFamily=Segoe UI"}},
ThemeTargetStyles{L"JumpViewUI.JumpListCategoryHeaderControl > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.TextBlock#HeadingTextBlock", {
L"Margin=12,10,12,6",
L"FontFamily=Segoe UI"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#SystemItemsContainer > Windows.UI.Xaml.Shapes.Rectangle", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#SystemItemsContainer", {
L"Padding=0,5,0,5"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Windows.UI.Xaml.Controls.Grid#LayoutRoot > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter > Windows.UI.Xaml.Controls.Grid#LayoutRoot > Windows.UI.Xaml.Shapes.Rectangle", {
L"Margin=12,4,12,4"}},
ThemeTargetStyles{L"JumpViewUI.JumpListControl#JumpList", {
L"Margin=0,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PinButton > Windows.UI.Xaml.Controls.Grid@CommonStates > Windows.UI.Xaml.Controls.Border#BackgroundBorder", {
L"Background@PointerOver:=",
L"Background@Pressed:=",
L"CornerRadius=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Border#JumpListAcrylic", {
L"Visibility=Visible"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#SystemItemsContainer > Windows.UI.Xaml.Controls.Border#SystemItemsAcrylic", {
L"Visibility=Visible",
L"Margin=0,-5,0,-5"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.MenuFlyoutPresenter > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius=0",
L"Background:="}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.MenuFlyoutItem", {
L"CornerRadius=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter#IconContent > Windows.UI.Xaml.Controls.FontIcon > Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.TextBlock", {
L"FontFamily=Segoe MDL2 Assets, Segoe UI"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.MenuFlyoutItem > Grid > TextBlock", {
L"FontSize=12",
L"FontFamily=Segoe UI"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.MenuFlyoutItem > Grid", {
L"BorderThickness=1,1,1,1",
L"Margin=0"}},
}};
const Theme g_themeWindowGlass = {{
ThemeTargetStyles{L"Grid#NotificationCenterGrid", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$CornerRadius",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$CornerRadius",
L"Margin=0,6,0,6",
L"MinHeight=40",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", {
L"Background:=$ElementBG",
L"CornerRadius=$r2",
L"Margin=-10,11,-10,-14",
L"BorderBrush:=$ElementBorderBrush",
L"BorderThickness=$ElementBorderThickness"}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", {
L"Background:=$ElementBG",
L"CornerRadius=$r2",
L"Margin=-10,-6,-10,-8",
L"Height=45",
L"BorderBrush:=$ElementBorderBrush",
L"BorderThickness=$ElementBorderThickness"}},
ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > Grid#FocusGrid", {
L"Background:=$Background",
L"CornerRadius=$r2",
L"Margin=6,7,6,6",
L"BorderThickness=$BorderThickness",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"MenuFlyoutPresenter", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$r3",
L"Padding=1,2,1,2",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$r3",
L"Margin=-2,-2,-2,-2",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ControlCenterRegion", {
L"Background:=$Background",
L"CornerRadius=$CornerRadius",
L"BorderThickness=$BorderThickness",
L"BorderBrush:=$BorderBrush",
L"Height=Auto",
L"MaxHeight:=380",
L"MinHeight:=300"}},
ThemeTargetStyles{L"ContentPresenter#PageContent", {
L"Background:=$transparent"}},
ThemeTargetStyles{L"ContentPresenter#PageContent > Grid > Border", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=8,0,8,2"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot", {
L"Background:=$transparent"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot > ContentPresenter#PageHeader", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=7,7,7,7"}},
ThemeTargetStyles{L"ScrollViewer#ListContent", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=8,0,8,0"}},
ThemeTargetStyles{L"ActionCenter.FlexibleToastView#FlexibleNormalToastView", {
L"Background:=$transparent"}},
ThemeTargetStyles{L"Border#ToastBackgroundBorder2", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=16",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"Background:=Trabsparent",
L"CornerRadius=8"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"CornerRadius=6"}},
ThemeTargetStyles{L"ActionCenter.FlexibleItemView", {
L"CornerRadius=16"}},
ThemeTargetStyles{L"Grid#NotificationCenterTopBanner", {
L"Background:=Transparent",
L"CornerRadius=$r2",
L"Margin=6"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border", {
L"Background:=$transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter", {
L"BorderThickness=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#FooterButton[AutomationProperties.Name=Edit quick settings]", {
L"Margin=0,0,8,0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button[AutomationProperties.AutomationId=Microsoft.QuickAction.Battery]", {
L"Margin=2,0,0,0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#FooterButton[AutomationProperties.Name=All settings]", {
L"Margin=0,0,-1,0",
L"CornerRadius=13",
L"BorderThickness=$BorderThickness"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button[AutomationProperties.AutomationId=Microsoft.QuickAction.Volume]", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#VolumeL2Button[AutomationProperties.Name=Select a sound output]", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#HorizontalTrackRect", {
L"Height=10",
L"Fill:=$overlay",
L"RadiusY=5",
L"RadiusX=5",
L"Margin=0,-10,10,-10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#HorizontalDecreaseRect", {
L"Height=10",
L"RadiusY=5",
L"RadiusX=5",
L"Margin=0,-10,-10,-10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb", {
L"Visibility=Visible",
L"Height=25",
L"Width=40",
L"Margin=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", {
L"Height=100",
L"CornerRadius=$CornerRadius",
L"BorderThickness=$BorderThickness",
L"Background:=$Background",
L"Margin=0,10,0,10",
L"BorderBrush:=$BorderBrush",
L"Grid.Row=1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#AlbumTextAndArtContainer", {
L"Height=55",
L"MaxWidth:=150",
L"HorizontalAlignment=Left"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ThumbnailImage", {
L"Visibility=1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer", {
L"VerticalAlignment=Center",
L"HorizontalAlignment=Left",
L"Margin=0,0,10,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#Title", {
L"TextAlignment=Center",
L"FontSize=18"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#Subtitle", {
L"TextAlignment=Center",
L"FontFamily=vivo Sans EN VF",
L"Margin=0,3,0,0",
L"FontWeight=600"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListView#MediaButtonsListView", {
L"VerticalAlignment=Center",
L"Height=20",
L"Margin=130,-60,0,0",
L"Width=Auto",
L"HorizontalAlignment=Right",
L"Visibility=2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#PreviousButton", {
L"Width=40",
L"Height=40",
L"Margin=10,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PlayPauseButton", {
L"Width=40",
L"Height=40",
L"Margin=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#NextButton", {
L"Width=40",
L"Height=30",
L"Margin=0,0,10,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.TextBlock#AppNameText", {
L"FontFamily=vivo Sans EN VF",
L"FontSize=16"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Image#IconImage", {
L"Height=20",
L"Width=20"}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRoot", {
L"Background:=$transparent"}},
ThemeTargetStyles{L"Grid#ToastPeekRegion", {
L"Background=",
L"RenderTransform:=",
L"Grid.Column=0",
L"Grid.Row=2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius=8",
L"Margin=1,2,1,2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem", {
L"CornerRadius=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Control > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarViewItem", {
L"CornerRadius=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListViewHeaderItem", {
L"Margin=50,6,50,2",
L"CornerRadius=8",
L"Height=35"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#SettingsButton", {
L"CornerRadius=4"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#DismissButton", {
L"CornerRadius=4"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#CalendarHeader", {
L"Margin=6,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ScrollContentPresenter#ScrollContentPresenter", {
L"Margin=1,2,1,2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#WeekDayNames", {
L"Background :=$ElementSysColor",
L"CornerRadius=8",
L"Margin=4,0,4,0",
L"Padding=0,-5,0,-3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListViewItem", {
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#RootGrid > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"Background:=",
L"BorderThickness=0",
L"CornerRadius=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.Border#ItemOpaquePlating", {
L"Background :=$overlay2",
L"BorderThickness=0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#StandardHeroContainer", {
L"Margin=12,0,12,0",
L"CornerRadius=0",
L"Height=150"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.ScrollBar#VerticalScrollBar", {
L"Visibility=1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#SliderContainer", {
L"Margin=0-2,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#BackButton", {
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#OuterBorder", {
L"RadiusX=8",
L"RadiusY=8",
L"Height=18"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#SwitchKnobOff", {
L"RadiusY=8",
L"RadiusX=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Border#SwitchKnobOn", {
L"CornerRadius=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#SwitchKnobBounds", {
L"RadiusX=8",
L"RadiusY=8",
L"Height=18"}},
ThemeTargetStyles{L"ActionCenter.NotificationListViewItem", {
L"Margin=5,2,5,3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid[AutomationProperties.LocalizedLandmarkType=Footer]", {
L"BorderThickness=0"}},
ThemeTargetStyles{L"NetworkUX.View.SettingsListViewItem > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root", {
L"CornerRadius=12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter > Windows.UI.Xaml.Controls.Border", {
L"BorderThickness=0"}},
ThemeTargetStyles{L"Button#ClearAll", {
L"AccessKey=x"}},
ThemeTargetStyles{L"Button#ExpandCollapseButton", {
L"AccessKey=e"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#ToggleButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"CornerRadius=$r2",
L"BorderThickness=$ElementBorderThickness",
L"BorderBrush:=$ElementBorderBrush"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#SplitL2Button > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"CornerRadius=30",
L"BorderThickness=$ElementBorderThickness",
L"BorderBrush:=$ElementBorderBrush"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius=12",
L"Background:=$Background",
L"BorderBrush:=$BorderBrush",
L"BorderThickness=$BorderThickness"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb > Windows.UI.Xaml.Controls.Border > Windows.UI.Xaml.Shapes.Ellipse#SliderInnerThumb", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ToolTip > Windows.UI.Xaml.Controls.ContentPresenter#LayoutRoot", {
L"Background:=$Background",
L"BorderBrush:=$BorderBrush",
L"BorderThickness=$BorderThickness",
L"CornerRadius=10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#PreviousButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Foreground@Normal:=$ElementSysColor",
L"Foreground@PointerOver:=$ElementSysColor2",
L"Foreground@Pressed:=$ElementSysColor3",
L"Foreground@Disabled:=$ElementSysColor4",
L"Background:=Transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PlayPauseButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Foreground@Normal:=$ElementSysColor",
L"Foreground@PointerOver:=$ElementSysColor2",
L"Foreground@Pressed:=$ElementSysColor3",
L"Foreground@Disabled:=$ElementSysColor4",
L"Background:=Transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#NextButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Foreground@Normal:=$ElementSysColor",
L"Foreground@PointerOver:=$ElementSysColor2",
L"Foreground@Pressed:=$ElementSysColor3",
L"Foreground@Disabled:=$ElementSysColor4",
L"Background:=Transparent"}},
ThemeTargetStyles{L"Grid#ControlCenterRegion", {
L"Grid.Row=0"}},
ThemeTargetStyles{L"ControlCenter.MediaTransportControls", {
L"VerticalAlignment=2",
L"Grid.Row=1",
L"Canvas.ZIndex=1"}},
ThemeTargetStyles{L"Grid#RootGrid", {
L"VerticalAlignment=3",
L"MinHeight=0"}},
}, {
L"transparent=",
L"Background=",
L"overlay=",
L"overlay2=",
L"CornerRadius=20",
L"r2=14",
L"r3=12",
L"BorderThickness=0.3,1,0.3,0.3",
L"BorderBrush2=",
L"Background2=",
L"ElementBG=",
L"ElementBorderBrush=",
L"ElementCornerRadius=20",
L"ElementBorderThickness=0.3,0.3,0.3,1",
L"BorderBrush=",
L"ElementSysColor=",
L"ElementSysColor2=",
L"ElementSysColor3=",
L"ElementSysColor4=",
}};
const Theme g_themeWindowGlass_variant_alternative = {{
ThemeTargetStyles{L"Grid#NotificationCenterGrid", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$CornerRadius",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$CornerRadius",
L"Margin = 0,6,0,6",
L"MinHeight = 40",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", {
L"Background:=$ElementBG",
L"CornerRadius=$r2",
L"Margin=-10,11,-10,-14",
L"BorderBrush:=$ElementBorderBrush",
L"BorderThickness=$ElementBorderThickness"}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", {
L"Background:=$ElementBG",
L"CornerRadius=$r2",
L"Margin=-10,-6,-10,-8",
L"Height=45",
L"BorderBrush:=$ElementBorderBrush",
L"BorderThickness=$ElementBorderThickness"}},
ThemeTargetStyles{L"ActionCenter.FocusSessionControl#FocusSessionControl > Grid#FocusGrid", {
L"Background:=$Background",
L"CornerRadius=$r2",
L"Margin=6,7,6,6",
L"BorderThickness=$BorderThickness",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"MenuFlyoutPresenter", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$r3",
L"Padding=1,2,1,2",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=$r3",
L"Margin=-2,-2,-2,-2",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ControlCenterRegion", {
L"Background:=$Background",
L"CornerRadius=$CornerRadius",
L"BorderThickness=$BorderThickness",
L"Margin=0,5,0,10",
L"BorderBrush:=$BorderBrush",
L"RenderTransform:=",
L"Height=Auto",
L"MaxHeight:=380",
L"MinHeight:=300"}},
ThemeTargetStyles{L"ContentPresenter#PageContent", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"ContentPresenter#PageContent > Grid > Border", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=8,0,8,2"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow > ContentPresenter > Grid#FullScreenPageRoot > ContentPresenter#PageHeader", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=7,7,7,7"}},
ThemeTargetStyles{L"ScrollViewer#ListContent", {
L"Background:=$overlay",
L"CornerRadius=$r2",
L"Margin=8,0,8,0"}},
ThemeTargetStyles{L"ActionCenter.FlexibleToastView#FlexibleNormalToastView", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"Border#ToastBackgroundBorder2", {
L"Background:=$Background",
L"BorderThickness=$BorderThickness",
L"CornerRadius=16",
L"BorderBrush:=$BorderBrush"}},
ThemeTargetStyles{L"JumpViewUI.SystemItemListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"Background:=Trabsparent",
L"CornerRadius=8"}},
ThemeTargetStyles{L"JumpViewUI.JumpListListViewItem > Grid#LayoutRoot > Border#BackgroundBorder", {
L"CornerRadius=6"}},
ThemeTargetStyles{L"ActionCenter.FlexibleItemView", {
L"CornerRadius=16"}},
ThemeTargetStyles{L"Grid#NotificationCenterTopBanner", {
L"Background:=Transparent",
L"CornerRadius=$r2",
L"Margin=6"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#L1Grid > Border", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter", {
L"BorderThickness=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#FooterButton[AutomationProperties.Name = Edit quick settings]", {
L"Margin = 0,0,8,0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button[AutomationProperties.AutomationId = Microsoft.QuickAction.Battery]", {
L"Margin = 2,0,0,0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#FooterButton[AutomationProperties.Name = All settings]", {
L"Margin = 0,0,-1,0",
L"CornerRadius = 13",
L"BorderThickness=$BorderThickness"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button[AutomationProperties.AutomationId = Microsoft.QuickAction.Volume]", {
L"CornerRadius = 10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#VolumeL2Button[AutomationProperties.Name = Select a sound output]", {
L"CornerRadius = 10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#HorizontalTrackRect", {
L"Height=10",
L"Fill:=$overlay",
L"RadiusY=5",
L"RadiusX=5",
L"Margin=0,-10,10,-10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#HorizontalDecreaseRect", {
L"Height=10",
L"RadiusY=5",
L"RadiusX=5",
L"Margin=0,-10,-10,-10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb", {
L"Visibility=Visible",
L"Height=25",
L"Width=40",
L"Margin=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#MediaTransportControlsRegion", {
L"Height=100",
L"CornerRadius=$CornerRadius",
L"BorderThickness=$BorderThickness",
L"Background:=$Background",
L"Margin=0,20,0,5",
L"BorderBrush:=$BorderBrush",
L"RenderTransform:="}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#AlbumTextAndArtContainer", {
L"Height=55",
L"MaxWidth:=150",
L"HorizontalAlignment=Left"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#ThumbnailImage", {
L"Visibility=1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer", {
L"VerticalAlignment=Center",
L"HorizontalAlignment=Left",
L"Margin=0,0,10,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#Title", {
L"TextAlignment=Center",
L"FontSize=18"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#PrimaryAndSecondaryTextContainer > Windows.UI.Xaml.Controls.TextBlock#Subtitle", {
L"TextAlignment=Center",
L"FontFamily=vivo Sans EN VF",
L"Margin = 0,3,0,0",
L"FontWeight=600"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListView#MediaButtonsListView", {
L"VerticalAlignment=Center",
L"Height=20",
L"Margin=130,-60,0,0",
L"Width=Auto",
L"HorizontalAlignment=Right",
L"Visibility=2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#PreviousButton", {
L"Width=40",
L"Height=40",
L"Margin=10,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PlayPauseButton", {
L"Width=40",
L"Height = 40",
L"Margin=0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#NextButton", {
L"Width=40",
L"Height = 30",
L"Margin=0,0,10,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.TextBlock#AppNameText", {
L"FontFamily=vivo Sans EN VF",
L"FontSize = 16"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Image#IconImage", {
L"Height = 20",
L"Width = 20"}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRoot", {
L"Background:= $transparent"}},
ThemeTargetStyles{L"Grid#ToastPeekRegion", {
L"Background =",
L"RenderTransform:=",
L"Grid.Column = 0",
L"Grid.Row = 2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius = 8",
L"Margin = 1,2,1,2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.CalendarViewDayItem", {
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Control > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarViewItem", {
L"CornerRadius = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListViewHeaderItem", {
L"Margin = 50,6,50,2",
L"CornerRadius = 8",
L"Height = 35"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#SettingsButton", {
L"CornerRadius = 4"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#DismissButton", {
L"CornerRadius = 4"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.StackPanel#CalendarHeader", {
L"Margin = 6,0,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ScrollContentPresenter#ScrollContentPresenter", {
L"Margin = 1,2,1,2"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#WeekDayNames", {
L"Background :=$ElementSysColor",
L"CornerRadius = 8",
L"Margin = 4,0,4,0",
L"Padding = 0,-5,0,-3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ListViewItem", {
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#RootGrid > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"Background:=",
L"BorderThickness=0",
L"CornerRadius=8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid > Windows.UI.Xaml.Controls.Border#ItemOpaquePlating", {
L"Background := $overlay2",
L"BorderThickness = 0",
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#StandardHeroContainer", {
L"Margin = 12,0,12,0",
L"CornerRadius = 0",
L"Height = 150"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.ScrollBar#VerticalScrollBar", {
L"Visibility = 1"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid#SliderContainer", {
L"Margin = 0-2,0,0"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#BackButton", {
L"CornerRadius=$r3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#OuterBorder", {
L"RadiusX = 8",
L"RadiusY = 8",
L"Height = 18"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#SwitchKnobOff", {
L"RadiusY = 8",
L"RadiusX = 8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Border#SwitchKnobOn", {
L"CornerRadius =8"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Shapes.Rectangle#SwitchKnobBounds", {
L"RadiusX =8",
L"RadiusY =8",
L"Height = 18"}},
ThemeTargetStyles{L"ActionCenter.NotificationListViewItem", {
L"Margin = 5,2,5,3"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Grid[AutomationProperties.LocalizedLandmarkType = Footer]", {
L"BorderThickness = 0"}},
ThemeTargetStyles{L"NetworkUX.View.SettingsListViewItem > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root", {
L"CornerRadius = 12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ContentPresenter > Windows.UI.Xaml.Controls.Border", {
L"BorderThickness = 0"}},
ThemeTargetStyles{L"Button#ClearAll", {
L"AccessKey=x"}},
ThemeTargetStyles{L"Button#ExpandCollapseButton", {
L"AccessKey=e"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#ToggleButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"CornerRadius=$r2",
L"BorderThickness=$ElementBorderThickness",
L"BorderBrush:=$ElementBorderBrush"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#SplitL2Button > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter", {
L"CornerRadius=30",
L"BorderThickness=$ElementBorderThickness",
L"BorderBrush:=$ElementBorderBrush"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb > Windows.UI.Xaml.Controls.Border", {
L"CornerRadius=12",
L"Background:=$Background",
L"BorderBrush:=$BorderBrush",
L"BorderThickness=$BorderThickness"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb > Windows.UI.Xaml.Controls.Border > Windows.UI.Xaml.Shapes.Ellipse#SliderInnerThumb", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.ToolTip > Windows.UI.Xaml.Controls.ContentPresenter#LayoutRoot", {
L"Background:=$Background",
L"BorderBrush:=$BorderBrush",
L"BorderThickness=$BorderThickness",
L"CornerRadius=10"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#PreviousButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Foreground@Normal:=$ElementSysColor",
L"Foreground@PointerOver:=$ElementSysColor2",
L"Foreground@Pressed:=$ElementSysColor3",
L"Foreground@Disabled:=$ElementSysColor4",
L"Background:=Transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Button#PlayPauseButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Foreground@Normal:=$ElementSysColor",
L"Foreground@PointerOver:=$ElementSysColor2",
L"Foreground@Pressed:=$ElementSysColor3",
L"Foreground@Disabled:=$ElementSysColor4",
L"Background:=Transparent"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.RepeatButton#NextButton > Windows.UI.Xaml.Controls.ContentPresenter#ContentPresenter@CommonStates", {
L"Foreground@Normal:=$ElementSysColor",
L"Foreground@PointerOver:=$ElementSysColor2",
L"Foreground@Pressed:=$ElementSysColor3",
L"Foreground@Disabled:=$ElementSysColor4",
L"Background:=Transparent"}},
}, {
L"transparent=",
L"Background=",
L"overlay=",
L"overlay2=",
L"CornerRadius=20",
L"r2=14",
L"r3=12",
L"BorderThickness=0.3,1,0.3,0.3",
L"BorderBrush2=",
L"Background2=",
L"ElementBG=",
L"ElementBorderBrush=",
L"ElementCornerRadius=20",
L"ElementBorderThickness=0.3,0.3,0.3,1",
L"BorderBrush=",
L"ElementSysColor=",
L"ElementSysColor2=",
L"ElementSysColor3=",
L"ElementSysColor4=",
}};
const Theme g_themeOversimplified_Accentuated = {{
ThemeTargetStyles{L"MenuFlyoutPresenter", {
L"Background:=$DarkAccent",
L"BorderBrush=Transparent",
L"Shadow:="}},
ThemeTargetStyles{L"ToolTip > ContentPresenter#LayoutRoot", {
L"Background:=$DarkAccent",
L"BorderBrush:=$Reveal",
L"Shadow:="}},
ThemeTargetStyles{L"Grid#NotificationCenterGrid", {
L"Background:=$Alt",
L"BorderBrush=Transparent",
L"Shadow:="}},
ThemeTargetStyles{L"TextBlock#NotificationsTextBlock", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Button#ClearAll", {
L"AccessKey=C"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.ToggleButton#DoNotDisturbButton", {
L"AccessKey=D"}},
ThemeTargetStyles{L"Microsoft.UI.Xaml.Controls.AnimatedIcon#DoNotDisturbButtonIcon", {
L"Height=16",
L"Width=16"}},
ThemeTargetStyles{L"Grid#DoNotDisturbSubtext", {
L"Background:=$Accent",
L"BorderBrush:=$Reveal",
L"BorderThickness=2",
L"CornerRadius=5",
L"Margin=0,0,0,10"}},
ThemeTargetStyles{L"Grid#DoNotDisturbSubtext > TextBlock[1]", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Grid#DoNotDisturbSubtext > TextBlock[2]", {
L"HorizontalAlignment=Center",
L"FontSize=18"}},
ThemeTargetStyles{L"Grid#DoNotDisturbSubtext > TextBlock[3]", {
L"TextAlignment=Center",
L"FontSize=11"}},
ThemeTargetStyles{L"Grid#DoNotDisturbSubtext > Button", {
L"HorizontalAlignment=Center",
L"Margin= 0,0,0,0"}},
ThemeTargetStyles{L"TextBlock#NotificationSettingsButtonText[Text=Notification settings]", {
L"Text=Settings"}},
ThemeTargetStyles{L"Border#ItemOpaquePlating", {
L"BorderBrush:=$Reveal"}},
ThemeTargetStyles{L"Border#StandardImageBorder", {
L"Height=30",
L"Width=30"}},
ThemeTargetStyles{L"Grid#GroupTitleGrid > TextBlock#Title", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Grid > Button#VerbButton", {
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Border#PopupBorder", {
L"Background:=$DarkAccent",
L"Shadow:="}},
ThemeTargetStyles{L"ProgressBar#progressBar > Grid > Border#DeterminateRoot", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Border#ToastBackgroundBorder2", {
L"Background:=$Alt",
L"BorderBrush=Transparent",
L"CornerRadius=15",
L"Shadow:="}},
ThemeTargetStyles{L"Border#AppLogoBorder2", {
L"Height=30",
L"Width=30"}},
ThemeTargetStyles{L"Border#AppLogoBorder", {
L"Height=30",
L"Width=30"}},
ThemeTargetStyles{L"Image#AppLogo2", {
L"Height=30",
L"Width=30"}},
ThemeTargetStyles{L"Grid#ToastTitleBar > TextBlock#SenderName", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Grid#CalendarCenterGrid", {
L"Background:=$Alt",
L"BorderBrush=Transparent",
L"CornerRadius=20",
L"Shadow:="}},
ThemeTargetStyles{L"Border#CalendarHeaderMinimizedOverlay", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Button#ExpandCollapseButton", {
L"Background=Transparent",
L"BorderBrush=Transparent",
L"AccessKey=E"}},
ThemeTargetStyles{L"ScrollViewer#CalendarControlScrollViewer", {
L"Background=Transparent",
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"CalendarViewDayItem", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"CalendarViewDayItem > Border", {
L"BorderBrush:= ",
L"CornerRadius=12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarPanel#YearViewPanel > Control", {
L"CornerRadius=12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarPanel#YearViewPanel > Control > Border", {
L"BorderBrush:=$Reveal",
L"BorderThickness=2",
L"CornerRadius=12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarPanel#DecadeViewPanel > Control", {
L"CornerRadius=12"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.CalendarPanel#DecadeViewPanel > Control > Border", {
L"BorderBrush:=$Reveal",
L"BorderThickness=2",
L"CornerRadius=12"}},
ThemeTargetStyles{L"Grid#FocusGrid", {
L"Background=Transparent",
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Button#IncreaseTimeButton", {
L"Background=Transparent",
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Button#DecreaseTimeButton", {
L"Background=Transparent",
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Button#StartButton", {
L"Background=Transparent",
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Grid#ControlCenterRegion", {
L"Background=Transparent",
L"BorderBrush=Transparent",
L"CornerRadius=20",
L"Shadow:="}},
ThemeTargetStyles{L"Grid#L1Grid > Border", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Grid#L1Grid", {
L"Background:=$Alt",
L"BorderBrush=Transparent",
L"CornerRadius=20"}},
ThemeTargetStyles{L"ControlCenter.PaginatedGridView > Grid > GridView#RootGridView", {
L"Height=auto"}},
ThemeTargetStyles{L"Microsoft.UI.Xaml.Controls.PipsPager#QuickActionsPager", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"ContentPresenter#ContentPresenter", {
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton", {
L"Height=60"}},
ThemeTargetStyles{L"ContentControl > ContentPresenter > Grid > Grid", {
L"CornerRadius=12"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton > ContentPresenter#ContentPresenter@CommonStates", {
L"Background@Normal:= ",
L"Background@Checked:=$Accent",
L"Background@CheckedPointerOver:= ",
L"Background@CheckedPressed:= ",
L"Background@CheckedDisabled:= "}},
ThemeTargetStyles{L"Grid > Microsoft.UI.Xaml.Controls.AnimatedIcon", {
L"Height=30",
L"Width=30"}},
ThemeTargetStyles{L"ContentPresenter#Content > StackPanel > TextBlock", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#ToggleButton[AutomationProperties.Name=Accessibility]", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#ToggleButton[AutomationProperties.Name=Cast]", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"ControlCenter.PaginatedToggleButton#ToggleButton[AutomationProperties.Name=Project]", {
L"CornerRadius=10"}},
ThemeTargetStyles{L"ControlCenter.PaginatedGridView > Grid", {
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Rectangle#HorizontalTrackRect", {
L"Opacity=0"}},
ThemeTargetStyles{L"Rectangle#HorizontalDecreaseRect", {
L"Fill:=$Accent",
L"Height=6"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb > Border", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.Thumb#HorizontalThumb", {
L"Width=0"}},
ThemeTargetStyles{L"Microsoft.UI.Xaml.Controls.AnimatedIcon#BrightnessPlayer", {
L"Height=25",
L"Width=25"}},
ThemeTargetStyles{L"Microsoft.UI.Xaml.Controls.AnimatedIcon#FooterButtonIcon", {
L"Height=25",
L"Width=25"}},
ThemeTargetStyles{L"Button#VolumeL2Button > ContentPresenter > StackPanel > FontIcon[1]", {
L"FontSize=20"}},
ThemeTargetStyles{L"StackPanel > ContentPresenter > ContentControl > ContentPresenter > Button > ContentPresenter > StackPanel > TextBlock#Icon", {
L"FontSize=25"}},
ThemeTargetStyles{L"StackPanel > ContentPresenter > ContentControl > ContentPresenter > Button > ContentPresenter > StackPanel > TextBlock[2]", {
L"FontSize=16"}},
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.Primitives.ToggleButton > ContentPresenter > Microsoft.UI.Xaml.Controls.AnimatedIcon", {
L"Height=25",
L"Width=25"}},
ThemeTargetStyles{L"Grid#L1Grid > Grid", {
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"ContentPresenter#PageHeader", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Grid#FullScreenPageRoot > ContentPresenter#PageHeader > Border > Grid > Button#BackButton", {
L"CornerRadius=14"}},
ThemeTargetStyles{L"ContentPresenter > Grid#FullScreenPageRoot", {
L"Background:=$DarkAccent"}},
ThemeTargetStyles{L"ContentPresenter#PageContent > Grid > Border", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Grid > ScrollViewer#ListContent", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Border#SwitchKnobOn", {
L"Background="}},
ThemeTargetStyles{L"StackPanel > ContentPresenter > Border", {
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Border#WADFeatureFooter", {
L"BorderBrush=Transparent"}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRoot", {
L"Background=Transparent"}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRegion", {
L"Background:=$DarkAccent",
L"BorderBrush=Transparent",
L"CornerRadius=20",
L"Height=Auto",
L"Shadow:="}},
ThemeTargetStyles{L"Grid#MediaTransportControlsRoot > Grid[2]", {
L"Margin=-8,0,0,12"}},
ThemeTargetStyles{L"StackPanel#PrimaryAndSecondaryTextContainer", {
L"Visibility=Collapsed"}},
ThemeTargetStyles{L"Grid#AlbumTextAndArtContainer", {
L"HorizontalAlignment=Center"}},
ThemeTargetStyles{L"Grid#ThumbnailImage", {
L"CornerRadius=15",
L"Height=300",
L"Width=300"}},
ThemeTargetStyles{L"Border#JumpListRestyledAcrylic", {
L"Background:=$DarkAccent",
L"CornerRadius=15",
L"Shadow:="}},
ThemeTargetStyles{L"GridViewItem[1] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=1"}},
ThemeTargetStyles{L"GridViewItem[2] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=2"}},
ThemeTargetStyles{L"GridViewItem[3] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=3"}},
ThemeTargetStyles{L"GridViewItem[4] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=4"}},
ThemeTargetStyles{L"GridViewItem[5] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=5"}},
ThemeTargetStyles{L"GridViewItem[6] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=6"}},
ThemeTargetStyles{L"GridViewItem[7] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=7"}},
ThemeTargetStyles{L"GridViewItem[8] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=8"}},
ThemeTargetStyles{L"GridViewItem[9] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=9"}},
ThemeTargetStyles{L"GridViewItem[10] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=0"}},
ThemeTargetStyles{L"GridViewItem[11] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=-"}},
ThemeTargetStyles{L"GridViewItem[1] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=1"}},
ThemeTargetStyles{L"GridViewItem[2] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=2"}},
ThemeTargetStyles{L"GridViewItem[3] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=3"}},
ThemeTargetStyles{L"GridViewItem[4] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=4"}},
ThemeTargetStyles{L"GridViewItem[5] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=5"}},
ThemeTargetStyles{L"GridViewItem[6] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=6"}},
ThemeTargetStyles{L"GridViewItem[7] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=7"}},
ThemeTargetStyles{L"GridViewItem[8] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=8"}},
ThemeTargetStyles{L"GridViewItem[9] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=9"}},
ThemeTargetStyles{L"GridViewItem[10] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=0"}},
ThemeTargetStyles{L"GridViewItem[11] > Windows.UI.Xaml.Controls.Primitives.ListViewItemPresenter#Root > ContentControl > ContentPresenter > Grid > ControlCenter.PaginatedToggleButton#ToggleButton", {
L"AccessKey=-"}},
ThemeTargetStyles{L"Grid#RootGrid > QuickActions.ControlCenter.FrameWithContentChanged#L2Frame", {
L"Background=Transparent"}},
ThemeTargetStyles{L"QuickActions.ControlCenter.AccessibleWindow#PageWindow", {
L"Background=Transparent"}},
}, {
L"Alt = ",
L"Accent = ",
L"DarkAccent = ",
L"SolidAccent = ",
L"Reveal = ",
}};
// clang-format on
std::atomic g_initialized;
thread_local bool g_initializedForThread;
void ApplyCustomizations(InstanceHandle handle,
winrt::Windows::UI::Xaml::FrameworkElement element,
PCWSTR fallbackClassName);
void CleanupCustomizations(InstanceHandle handle);
HMODULE GetCurrentModuleHandle() {
HMODULE module;
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
L"", &module)) {
return nullptr;
}
return module;
}
////////////////////////////////////////////////////////////////////////////////
// clang-format off
#pragma region winrt_hpp
#include
#include
// forward declare namespaces we alias
namespace winrt {
namespace Windows {
namespace Foundation {}
namespace UI::Xaml {}
}
}
// alias some long namespaces for convenience
namespace wf = winrt::Windows::Foundation;
namespace wux = winrt::Windows::UI::Xaml;
#pragma endregion // winrt_hpp
#pragma region visualtreewatcher_hpp
#include
class VisualTreeWatcher : public winrt::implements
{
public:
VisualTreeWatcher(winrt::com_ptr site);
VisualTreeWatcher(const VisualTreeWatcher&) = delete;
VisualTreeWatcher& operator=(const VisualTreeWatcher&) = delete;
VisualTreeWatcher(VisualTreeWatcher&&) = delete;
VisualTreeWatcher& operator=(VisualTreeWatcher&&) = delete;
~VisualTreeWatcher();
void UnadviseVisualTreeChange();
private:
HRESULT STDMETHODCALLTYPE OnVisualTreeChange(ParentChildRelation relation, VisualElement element, VisualMutationType mutationType) override;
HRESULT STDMETHODCALLTYPE OnElementStateChanged(InstanceHandle element, VisualElementState elementState, LPCWSTR context) noexcept override;
wf::IInspectable FromHandle(InstanceHandle handle)
{
wf::IInspectable obj;
winrt::check_hresult(m_XamlDiagnostics->GetIInspectableFromHandle(handle, reinterpret_cast<::IInspectable**>(winrt::put_abi(obj))));
return obj;
}
winrt::com_ptr m_XamlDiagnostics = nullptr;
};
#pragma endregion // visualtreewatcher_hpp
#pragma region visualtreewatcher_cpp
VisualTreeWatcher::VisualTreeWatcher(winrt::com_ptr site) :
m_XamlDiagnostics(site.as())
{
Wh_Log(L"Constructing VisualTreeWatcher");
// winrt::check_hresult(m_XamlDiagnostics.as()->AdviseVisualTreeChange(this));
// Calling AdviseVisualTreeChange from the current thread causes the app to
// hang in Advising::RunOnUIThread sometimes. Creating a new thread and
// calling it from there fixes it.
HANDLE thread = CreateThread(
nullptr, 0,
[](LPVOID lpParam) -> DWORD {
auto watcher = reinterpret_cast(lpParam);
HRESULT hr = watcher->m_XamlDiagnostics.as()->AdviseVisualTreeChange(watcher);
watcher->Release();
if (FAILED(hr)) {
Wh_Log(L"Error %08X", hr);
}
return 0;
},
this, 0, nullptr);
if (thread) {
AddRef();
CloseHandle(thread);
}
}
VisualTreeWatcher::~VisualTreeWatcher()
{
Wh_Log(L"Destructing VisualTreeWatcher");
}
void VisualTreeWatcher::UnadviseVisualTreeChange()
{
Wh_Log(L"UnadviseVisualTreeChange VisualTreeWatcher");
winrt::check_hresult(m_XamlDiagnostics.as()->UnadviseVisualTreeChange(this));
}
HRESULT VisualTreeWatcher::OnVisualTreeChange(ParentChildRelation, VisualElement element, VisualMutationType mutationType) try
{
Wh_Log(L"========================================");
if (!g_initializedForThread) {
Wh_Log(L"NOTE: Not initialized for thread %u", GetCurrentThreadId());
}
switch (mutationType)
{
case Add:
Wh_Log(L"Mutation type: Add");
break;
case Remove:
Wh_Log(L"Mutation type: Remove");
break;
default:
Wh_Log(L"Mutation type: %d", static_cast(mutationType));
break;
}
Wh_Log(L"Element type: %s", element.Type);
if (mutationType == Add)
{
const auto inspectable = FromHandle(element.Handle);
auto frameworkElement = inspectable.try_as();
if (frameworkElement)
{
Wh_Log(L"FrameworkElement name: %s", frameworkElement.Name().c_str());
ApplyCustomizations(element.Handle, frameworkElement, element.Type);
}
else
{
Wh_Log(L"Skipping non-FrameworkElement");
}
}
else if (mutationType == Remove)
{
CleanupCustomizations(element.Handle);
}
return S_OK;
}
catch (...)
{
HRESULT hr = winrt::to_hresult();
Wh_Log(L"Error %08X", hr);
// Returning an error prevents (some?) further messages, always return
// success.
// return hr;
return S_OK;
}
HRESULT VisualTreeWatcher::OnElementStateChanged(InstanceHandle, VisualElementState, LPCWSTR) noexcept
{
return S_OK;
}
#pragma endregion // visualtreewatcher_cpp
#pragma region tap_hpp
#include
winrt::com_ptr g_visualTreeWatcher;
// {C85D8CC7-5463-40E8-A432-F5916B6427E5}
static constexpr CLSID CLSID_WindhawkTAP = { 0xc85d8cc7, 0x5463, 0x40e8, { 0xa4, 0x32, 0xf5, 0x91, 0x6b, 0x64, 0x27, 0xe5 } };
class WindhawkTAP : public winrt::implements
{
public:
HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite) override;
HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite) noexcept override;
private:
winrt::com_ptr site;
};
#pragma endregion // tap_hpp
#pragma region tap_cpp
HRESULT WindhawkTAP::SetSite(IUnknown *pUnkSite) try
{
// Only ever 1 VTW at once.
if (g_visualTreeWatcher)
{
g_visualTreeWatcher->UnadviseVisualTreeChange();
g_visualTreeWatcher = nullptr;
}
site.copy_from(pUnkSite);
if (site)
{
// Decrease refcount increased by InitializeXamlDiagnosticsEx.
FreeLibrary(GetCurrentModuleHandle());
g_visualTreeWatcher = winrt::make_self(site);
}
return S_OK;
}
catch (...)
{
HRESULT hr = winrt::to_hresult();
Wh_Log(L"Error %08X", hr);
return hr;
}
HRESULT WindhawkTAP::GetSite(REFIID riid, void **ppvSite) noexcept
{
return site.as(riid, ppvSite);
}
#pragma endregion // tap_cpp
#pragma region simplefactory_hpp
#include
template
struct SimpleFactory : winrt::implements, IClassFactory, winrt::non_agile>
{
HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject) override try
{
if (!pUnkOuter)
{
*ppvObject = nullptr;
return winrt::make().as(riid, ppvObject);
}
else
{
return CLASS_E_NOAGGREGATION;
}
}
catch (...)
{
HRESULT hr = winrt::to_hresult();
Wh_Log(L"Error %08X", hr);
return hr;
}
HRESULT STDMETHODCALLTYPE LockServer(BOOL) noexcept override
{
return S_OK;
}
};
#pragma endregion // simplefactory_hpp
#pragma region module_cpp
#include
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdll-attribute-on-redeclaration"
__declspec(dllexport)
_Use_decl_annotations_ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) try
{
if (rclsid == CLSID_WindhawkTAP)
{
*ppv = nullptr;
return winrt::make>().as(riid, ppv);
}
else
{
return CLASS_E_CLASSNOTAVAILABLE;
}
}
catch (...)
{
HRESULT hr = winrt::to_hresult();
Wh_Log(L"Error %08X", hr);
return hr;
}
__declspec(dllexport)
_Use_decl_annotations_ STDAPI DllCanUnloadNow(void)
{
if (winrt::get_module_lock())
{
return S_FALSE;
}
else
{
return S_OK;
}
}
#pragma clang diagnostic pop
#pragma endregion // module_cpp
#pragma region api_cpp
using PFN_INITIALIZE_XAML_DIAGNOSTICS_EX = decltype(&InitializeXamlDiagnosticsEx);
HRESULT InjectWindhawkTAP() noexcept
{
HMODULE module = GetCurrentModuleHandle();
if (!module)
{
return HRESULT_FROM_WIN32(GetLastError());
}
WCHAR location[MAX_PATH];
switch (GetModuleFileName(module, location, ARRAYSIZE(location)))
{
case 0:
case ARRAYSIZE(location):
return HRESULT_FROM_WIN32(GetLastError());
}
const HMODULE wux(LoadLibraryEx(L"Windows.UI.Xaml.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32));
if (!wux) [[unlikely]]
{
return HRESULT_FROM_WIN32(GetLastError());
}
const auto ixde = reinterpret_cast(GetProcAddress(wux, "InitializeXamlDiagnosticsEx"));
if (!ixde) [[unlikely]]
{
return HRESULT_FROM_WIN32(GetLastError());
}
// I didn't find a better way than trying many connections until one works.
// Reference:
// https://github.com/microsoft/microsoft-ui-xaml/blob/d74a0332cf0d5e58f12eddce1070fa7a79b4c2db/src/dxaml/xcp/dxaml/lib/DXamlCore.cpp#L2782
HRESULT hr;
for (int i = 0; i < 10000; i++)
{
WCHAR connectionName[256];
wsprintf(connectionName, L"VisualDiagConnection%d", i + 1);
hr = ixde(connectionName, GetCurrentProcessId(), L"", location, CLSID_WindhawkTAP, nullptr);
if (hr != HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
{
break;
}
}
return hr;
}
#pragma endregion // api_cpp
// clang-format on
////////////////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std::string_view_literals;
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace winrt::Windows::UI::Xaml;
enum class Target {
ShellExperienceHost,
ShellHost, // Win11 24H2.
};
Target g_target;
// https://stackoverflow.com/a/51274008
template
struct deleter_from_fn {
template
constexpr void operator()(T* arg) const {
fn(arg);
}
};
using string_setting_unique_ptr =
std::unique_ptr>;
using PropertyKeyValue =
std::pair;
using PropertyValuesUnresolved =
std::vector>;
using PropertyValues = std::vector;
using PropertyValuesMaybeUnresolved =
std::variant;
struct ElementMatcher {
std::wstring type;
std::wstring name;
std::optional visualStateGroupName;
int oneBasedIndex = 0;
PropertyValuesMaybeUnresolved propertyValues;
};
struct StyleRule {
std::wstring name;
std::wstring visualState;
std::wstring value;
bool isXamlValue = false;
};
using PropertyOverridesUnresolved = std::vector;
struct XamlBlurBrushParams {
float blurAmount;
winrt::Windows::UI::Color tint;
std::optional tintOpacity;
std::wstring tintThemeResourceKey; // Empty if not from ThemeResource
};
using PropertyOverrideValue =
std::variant;
// Property -> visual state -> value.
using PropertyOverrides =
std::unordered_map>;
using PropertyOverridesMaybeUnresolved =
std::variant;
struct ElementCustomizationRules {
ElementMatcher elementMatcher;
std::vector parentElementMatchers;
PropertyOverridesMaybeUnresolved propertyOverrides;
};
thread_local std::vector
g_elementsCustomizationRules;
struct ElementPropertyCustomizationState {
std::optional originalValue;
std::optional customValue;
int64_t propertyChangedToken = 0;
};
struct ElementCustomizationStateForVisualStateGroup {
std::unordered_map
propertyCustomizationStates;
winrt::event_token visualStateGroupCurrentStateChangedToken;
};
struct ElementCustomizationState {
winrt::weak_ref element;
// Use list to avoid reallocations on insertion, as pointers to items are
// captured in callbacks and stored.
std::list>,
ElementCustomizationStateForVisualStateGroup>>
perVisualStateGroup;
};
thread_local std::unordered_map
g_elementsCustomizationState;
thread_local bool g_elementPropertyModifying;
// Global list to track ImageBrushes with failed loads for retry on network
// reconnection.
struct ImageBrushFailedLoadInfo {
winrt::weak_ref brush;
winrt::hstring imageSource;
Media::ImageBrush::ImageFailed_revoker imageFailedRevoker;
Media::ImageBrush::ImageOpened_revoker imageOpenedRevoker;
};
struct FailedImageBrushesForThread {
std::list failedImageBrushes;
winrt::Windows::System::DispatcherQueue dispatcher{nullptr};
};
thread_local FailedImageBrushesForThread g_failedImageBrushesForThread;
// Global registry of all threads that have failed image brushes.
std::mutex g_failedImageBrushesRegistryMutex;
std::vector>
g_failedImageBrushesRegistry;
winrt::event_token g_networkStatusChangedToken;
winrt::Windows::Foundation::IInspectable ReadLocalValueWithWorkaround(
DependencyObject elementDo,
DependencyProperty property) {
const auto value = elementDo.ReadLocalValue(property);
if (value && winrt::get_class_name(value) ==
L"Windows.UI.Xaml.Data.BindingExpressionBase") {
// BindingExpressionBase was observed to be returned for XAML properties
// that were declared as following:
//
//
//
// Calling SetValue with it fails with an error, so we won't be able to
// use it to restore the value. As a workaround, we use
// GetAnimationBaseValue to get the value.
return elementDo.GetAnimationBaseValue(property);
}
return value;
}
// Blur background implementation, copied from TranslucentTB.
////////////////////////////////////////////////////////////////////////////////
// clang-format off
#include
#include
namespace wge = winrt::Windows::Graphics::Effects;
namespace wuc = winrt::Windows::UI::Composition;
namespace wuxh = wux::Hosting;
template <> inline constexpr winrt::guid winrt::impl::guid_v>{
winrt::impl::guid_v
};
#ifndef E_BOUNDS
#define E_BOUNDS (HRESULT)(0x8000000BL)
#endif
typedef enum MY_D2D1_GAUSSIANBLUR_OPTIMIZATION
{
MY_D2D1_GAUSSIANBLUR_OPTIMIZATION_SPEED = 0,
MY_D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED = 1,
MY_D2D1_GAUSSIANBLUR_OPTIMIZATION_QUALITY = 2,
MY_D2D1_GAUSSIANBLUR_OPTIMIZATION_FORCE_DWORD = 0xffffffff
} MY_D2D1_GAUSSIANBLUR_OPTIMIZATION;
////////////////////////////////////////////////////////////////////////////////
// XamlBlurBrush.h
#include
#include
#include
#include
class XamlBlurBrush : public wux::Media::XamlCompositionBrushBaseT
{
public:
XamlBlurBrush(wuc::Compositor compositor,
float blurAmount,
winrt::Windows::UI::Color tint,
std::optional tintOpacity,
winrt::hstring tintThemeResourceKey);
void OnConnected();
void OnDisconnected();
// The ISolidColorBrush implementation is required for
// ActionCenter::FlexibleToastView::OnToastBackgroundBorderBackgroundChanged
// in Windows.UI.ActionCenter.dll. If missing, the app crashes while trying
// to show the first notification, which results in a crash loop.
winrt::Windows::UI::Color Color() const {
return m_tint;
}
void Color(winrt::Windows::UI::Color const& value) {
// Do nothing.
}
private:
void RefreshThemeTint();
void OnThemeRefreshed();
wuc::Compositor m_compositor;
float m_blurAmount;
winrt::Windows::UI::Color m_tint;
std::optional m_tintOpacity;
winrt::hstring m_tintThemeResourceKey;
winrt::Windows::UI::ViewManagement::UISettings m_uiSettings;
};
////////////////////////////////////////////////////////////////////////////////
// CompositeEffect.h
#include
#include
#include
#include
// #include
#include
#include
#ifndef BUILD_WINDOWS
namespace ABI {
#endif
namespace Windows {
namespace Graphics {
namespace Effects {
typedef interface IGraphicsEffectSource IGraphicsEffectSource;
typedef interface IGraphicsEffectD2D1Interop IGraphicsEffectD2D1Interop;
typedef enum GRAPHICS_EFFECT_PROPERTY_MAPPING
{
GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN,
GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT,
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX,
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY,
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ,
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW,
GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4,
GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES,
GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE,
GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3,
GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4
} GRAPHICS_EFFECT_PROPERTY_MAPPING;
//+-----------------------------------------------------------------------------
//
// Interface:
// IGraphicsEffectD2D1Interop
//
// Synopsis:
// An interface providing a Interop counterpart to IGraphicsEffect
// and allowing for metadata queries.
//
//------------------------------------------------------------------------------
#undef INTERFACE
#define INTERFACE IGraphicsEffectD2D1Interop
DECLARE_INTERFACE_IID_(IGraphicsEffectD2D1Interop, IUnknown, "2FC57384-A068-44D7-A331-30982FCF7177")
{
STDMETHOD(GetEffectId)(
_Out_ GUID * id
) PURE;
STDMETHOD(GetNamedPropertyMapping)(
LPCWSTR name,
_Out_ UINT * index,
_Out_ GRAPHICS_EFFECT_PROPERTY_MAPPING * mapping
) PURE;
STDMETHOD(GetPropertyCount)(
_Out_ UINT * count
) PURE;
STDMETHOD(GetProperty)(
UINT index,
_Outptr_ winrt::impl::abi_t ** value
) PURE;
STDMETHOD(GetSource)(
UINT index,
_Outptr_ IGraphicsEffectSource ** source
) PURE;
STDMETHOD(GetSourceCount)(
_Out_ UINT * count
) PURE;
};
} // namespace Effects
} // namespace Graphics
} // namespace Windows
#ifndef BUILD_WINDOWS
} // namespace ABI
#endif
template <> inline constexpr winrt::guid winrt::impl::guid_v{
0x2FC57384, 0xA068, 0x44D7, { 0xA3, 0x31, 0x30, 0x98, 0x2F, 0xCF, 0x71, 0x77 }
};
namespace awge = ABI::Windows::Graphics::Effects;
struct CompositeEffect : winrt::implements
{
public:
// IGraphicsEffectD2D1Interop
HRESULT STDMETHODCALLTYPE GetEffectId(GUID* id) noexcept override;
HRESULT STDMETHODCALLTYPE GetNamedPropertyMapping(LPCWSTR name, UINT* index, awge::GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) noexcept override;
HRESULT STDMETHODCALLTYPE GetPropertyCount(UINT* count) noexcept override;
HRESULT STDMETHODCALLTYPE GetProperty(UINT index, winrt::impl::abi_t** value) noexcept override;
HRESULT STDMETHODCALLTYPE GetSource(UINT index, awge::IGraphicsEffectSource** source) noexcept override;
HRESULT STDMETHODCALLTYPE GetSourceCount(UINT* count) noexcept override;
// IGraphicsEffect
winrt::hstring Name();
void Name(winrt::hstring name);
std::vector Sources;
D2D1_COMPOSITE_MODE Mode = D2D1_COMPOSITE_MODE_SOURCE_OVER;
private:
winrt::hstring m_name = L"CompositeEffect";
};
////////////////////////////////////////////////////////////////////////////////
// CompositeEffect.cpp
HRESULT CompositeEffect::GetEffectId(GUID* id) noexcept
{
if (id == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*id = CLSID_D2D1Composite;
return S_OK;
}
HRESULT CompositeEffect::GetNamedPropertyMapping(LPCWSTR name, UINT* index, awge::GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) noexcept
{
if (index == nullptr || mapping == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
const std::wstring_view nameView(name);
if (nameView == L"Mode")
{
*index = D2D1_COMPOSITE_PROP_MODE;
*mapping = awge::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
return S_OK;
}
return E_INVALIDARG;
}
HRESULT CompositeEffect::GetPropertyCount(UINT* count) noexcept
{
if (count == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*count = 1;
return S_OK;
}
HRESULT CompositeEffect::GetProperty(UINT index, winrt::impl::abi_t** value) noexcept try
{
if (value == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
switch (index)
{
case D2D1_COMPOSITE_PROP_MODE:
*value = wf::PropertyValue::CreateUInt32((UINT32)Mode).as>().detach();
break;
default:
return E_BOUNDS;
}
return S_OK;
}
catch (...)
{
return winrt::to_hresult();
}
HRESULT CompositeEffect::GetSource(UINT index, awge::IGraphicsEffectSource** source) noexcept try
{
if (source == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
winrt::copy_to_abi(Sources.at(index), *reinterpret_cast(source));
return S_OK;
}
catch (...)
{
return winrt::to_hresult();
}
HRESULT CompositeEffect::GetSourceCount(UINT* count) noexcept
{
if (count == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*count = static_cast(Sources.size());
return S_OK;
}
winrt::hstring CompositeEffect::Name()
{
return m_name;
}
void CompositeEffect::Name(winrt::hstring name)
{
m_name = name;
}
////////////////////////////////////////////////////////////////////////////////
// FloodEffect.h
#include
#include
#include
#include
// #include
namespace awge = ABI::Windows::Graphics::Effects;
struct FloodEffect : winrt::implements
{
public:
// IGraphicsEffectD2D1Interop
HRESULT STDMETHODCALLTYPE GetEffectId(GUID* id) noexcept override;
HRESULT STDMETHODCALLTYPE GetNamedPropertyMapping(LPCWSTR name, UINT* index, awge::GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) noexcept override;
HRESULT STDMETHODCALLTYPE GetPropertyCount(UINT* count) noexcept override;
HRESULT STDMETHODCALLTYPE GetProperty(UINT index, winrt::impl::abi_t** value) noexcept override;
HRESULT STDMETHODCALLTYPE GetSource(UINT index, awge::IGraphicsEffectSource** source) noexcept override;
HRESULT STDMETHODCALLTYPE GetSourceCount(UINT* count) noexcept override;
// IGraphicsEffect
winrt::hstring Name();
void Name(winrt::hstring name);
winrt::Windows::UI::Color Color{};
private:
winrt::hstring m_name = L"FloodEffect";
};
////////////////////////////////////////////////////////////////////////////////
// FloodEffect.cpp
HRESULT FloodEffect::GetEffectId(GUID* id) noexcept
{
if (id == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*id = CLSID_D2D1Flood;
return S_OK;
}
HRESULT FloodEffect::GetNamedPropertyMapping(LPCWSTR name, UINT* index, awge::GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) noexcept
{
if (index == nullptr || mapping == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
const std::wstring_view nameView(name);
if (nameView == L"Color")
{
*index = D2D1_FLOOD_PROP_COLOR;
*mapping = awge::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
return S_OK;
}
return E_INVALIDARG;
}
HRESULT FloodEffect::GetPropertyCount(UINT* count) noexcept
{
if (count == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*count = 1;
return S_OK;
}
HRESULT FloodEffect::GetProperty(UINT index, winrt::impl::abi_t** value) noexcept try
{
if (value == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
switch (index)
{
case D2D1_FLOOD_PROP_COLOR:
*value = wf::PropertyValue::CreateSingleArray({
Color.R / 255.0f,
Color.G / 255.0f,
Color.B / 255.0f,
Color.A / 255.0f,
}).as>().detach();
break;
default:
return E_BOUNDS;
}
return S_OK;
}
catch (...)
{
return winrt::to_hresult();
}
HRESULT FloodEffect::GetSource(UINT, awge::IGraphicsEffectSource** source) noexcept
{
if (source == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
return E_BOUNDS;
}
HRESULT FloodEffect::GetSourceCount(UINT* count) noexcept
{
if (count == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*count = 0;
return S_OK;
}
winrt::hstring FloodEffect::Name()
{
return m_name;
}
void FloodEffect::Name(winrt::hstring name)
{
m_name = name;
}
////////////////////////////////////////////////////////////////////////////////
// GaussianBlurEffect.h
#include
#include
#include
// #include
namespace wge = winrt::Windows::Graphics::Effects;
namespace awge = ABI::Windows::Graphics::Effects;
struct GaussianBlurEffect : winrt::implements
{
public:
// IGraphicsEffectD2D1Interop
HRESULT STDMETHODCALLTYPE GetEffectId(GUID* id) noexcept override;
HRESULT STDMETHODCALLTYPE GetNamedPropertyMapping(LPCWSTR name, UINT* index, awge::GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) noexcept override;
HRESULT STDMETHODCALLTYPE GetPropertyCount(UINT* count) noexcept override;
HRESULT STDMETHODCALLTYPE GetProperty(UINT index, winrt::impl::abi_t** value) noexcept override;
HRESULT STDMETHODCALLTYPE GetSource(UINT index, awge::IGraphicsEffectSource** source) noexcept override;
HRESULT STDMETHODCALLTYPE GetSourceCount(UINT* count) noexcept override;
// IGraphicsEffect
winrt::hstring Name();
void Name(winrt::hstring name);
wge::IGraphicsEffectSource Source;
float BlurAmount = 3.0f;
MY_D2D1_GAUSSIANBLUR_OPTIMIZATION Optimization = MY_D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED;
D2D1_BORDER_MODE BorderMode = D2D1_BORDER_MODE_SOFT;
private:
winrt::hstring m_name = L"GaussianBlurEffect";
};
////////////////////////////////////////////////////////////////////////////////
// GaussianBlurEffect.cpp
HRESULT GaussianBlurEffect::GetEffectId(GUID* id) noexcept
{
if (id == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*id = CLSID_D2D1GaussianBlur;
return S_OK;
}
HRESULT GaussianBlurEffect::GetNamedPropertyMapping(LPCWSTR name, UINT* index, awge::GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) noexcept
{
if (index == nullptr || mapping == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
const std::wstring_view nameView(name);
if (nameView == L"BlurAmount")
{
*index = D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION;
*mapping = awge::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
return S_OK;
}
else if (nameView == L"Optimization")
{
*index = D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION;
*mapping = awge::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
return S_OK;
}
else if (nameView == L"BorderMode")
{
*index = D2D1_GAUSSIANBLUR_PROP_BORDER_MODE;
*mapping = awge::GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
return S_OK;
}
return E_INVALIDARG;
}
HRESULT GaussianBlurEffect::GetPropertyCount(UINT* count) noexcept
{
if (count == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*count = 3;
return S_OK;
}
HRESULT GaussianBlurEffect::GetProperty(UINT index, winrt::impl::abi_t** value) noexcept try
{
if (value == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
switch (index)
{
case D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION:
*value = wf::PropertyValue::CreateSingle(BlurAmount).as>().detach();
break;
case D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION:
*value = wf::PropertyValue::CreateUInt32((UINT32)Optimization).as>().detach();
break;
case D2D1_GAUSSIANBLUR_PROP_BORDER_MODE:
*value = wf::PropertyValue::CreateUInt32((UINT32)BorderMode).as>().detach();
break;
default:
return E_BOUNDS;
}
return S_OK;
}
catch (...)
{
return winrt::to_hresult();
}
HRESULT GaussianBlurEffect::GetSource(UINT index, awge::IGraphicsEffectSource** source) noexcept
{
if (source == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
if (index == 0)
{
winrt::copy_to_abi(Source, *reinterpret_cast(source));
return S_OK;
}
else
{
return E_BOUNDS;
}
}
HRESULT GaussianBlurEffect::GetSourceCount(UINT* count) noexcept
{
if (count == nullptr) [[unlikely]]
{
return E_INVALIDARG;
}
*count = 1;
return S_OK;
}
winrt::hstring GaussianBlurEffect::Name()
{
return m_name;
}
void GaussianBlurEffect::Name(winrt::hstring name)
{
m_name = name;
}
////////////////////////////////////////////////////////////////////////////////
// XamlBlurBrush.cpp
#include
XamlBlurBrush::XamlBlurBrush(wuc::Compositor compositor,
float blurAmount,
winrt::Windows::UI::Color tint,
std::optional tintOpacity,
winrt::hstring tintThemeResourceKey) :
m_compositor(std::move(compositor)),
m_blurAmount(blurAmount),
m_tint(tint),
m_tintOpacity(tintOpacity),
m_tintThemeResourceKey(std::move(tintThemeResourceKey))
{
if (!m_tintThemeResourceKey.empty())
{
RefreshThemeTint();
auto dq = winrt::Windows::System::DispatcherQueue::GetForCurrentThread();
m_uiSettings.ColorValuesChanged([weakThis = get_weak(), dq] (auto const&, auto const&)
{
dq.TryEnqueue([weakThis]
{
if (auto self = weakThis.get())
{
self->OnThemeRefreshed();
}
});
});
}
}
void XamlBlurBrush::OnConnected()
{
if (!CompositionBrush())
{
auto backdropBrush = m_compositor.CreateBackdropBrush();
auto blurEffect = winrt::make_self();
blurEffect->Source = wuc::CompositionEffectSourceParameter(L"backdrop");
blurEffect->BlurAmount = m_blurAmount;
auto floodEffect = winrt::make_self();
floodEffect->Color = m_tint;
auto compositeEffect = winrt::make_self();
compositeEffect->Sources.push_back(*blurEffect);
compositeEffect->Sources.push_back(*floodEffect);
compositeEffect->Mode = D2D1_COMPOSITE_MODE_SOURCE_OVER;
auto factory = m_compositor.CreateEffectFactory(
*compositeEffect,
// List of animatable properties.
{L"FloodEffect.Color"}
);
auto blurBrush = factory.CreateBrush();
blurBrush.SetSourceParameter(L"backdrop", backdropBrush);
CompositionBrush(blurBrush);
}
}
void XamlBlurBrush::OnDisconnected()
{
if (const auto brush = CompositionBrush())
{
brush.Close();
CompositionBrush(nullptr);
}
}
void XamlBlurBrush::RefreshThemeTint()
{
if (m_tintThemeResourceKey.empty())
{
return;
}
auto resources = Application::Current().Resources();
auto resource = resources.TryLookup(winrt::box_value(m_tintThemeResourceKey));
if (!resource)
{
Wh_Log(L"Failed to find resource");
return;
}
if (auto colorBrush = resource.try_as())
{
m_tint = colorBrush.Color();
}
else if (auto color = resource.try_as())
{
m_tint = *color;
}
else
{
Wh_Log(L"Resource type is unsupported: %s",
winrt::get_class_name(resource).c_str());
return;
}
if (m_tintOpacity)
{
m_tint.A = *m_tintOpacity;
}
}
void XamlBlurBrush::OnThemeRefreshed()
{
Wh_Log(L"Theme refreshed");
auto prevTint = m_tint;
RefreshThemeTint();
if (prevTint != m_tint)
{
if (auto effectBrush = CompositionBrush().try_as())
{
effectBrush.Properties().InsertColor(L"FloodEffect.Color", m_tint);
}
}
}
// clang-format on
////////////////////////////////////////////////////////////////////////////////
// Helper functions for tracking and retrying failed ImageBrush loads.
void RetryFailedImageLoadsOnCurrentThread() {
Wh_Log(L"Retrying failed image loads on current thread");
auto& failedImageBrushes = g_failedImageBrushesForThread.failedImageBrushes;
// Retry loading all failed images by re-setting the ImageSource property.
for (auto& info : failedImageBrushes) {
if (auto brush = info.brush.get()) {
try {
Wh_Log(L"Retrying image load for: %s",
info.imageSource.c_str());
// Clear the ImageSource first to force a reload.
brush.ImageSource(nullptr);
// Then create a new BitmapImage and set it.
Media::Imaging::BitmapImage bitmapImage;
bitmapImage.UriSource(
winrt::Windows::Foundation::Uri(info.imageSource));
brush.ImageSource(bitmapImage);
} catch (winrt::hresult_error const& ex) {
Wh_Log(L"Error retrying image load %08X: %s", ex.code(),
ex.message().c_str());
}
}
}
// Clean up any weak refs that are no longer valid.
std::erase_if(failedImageBrushes,
[](const auto& info) { return !info.brush.get(); });
}
void OnNetworkStatusChanged(
winrt::Windows::Foundation::IInspectable const& sender) {
Wh_Log(L"Network status changed, dispatching retry to all UI threads");
// Get snapshot of dispatchers under lock.
std::vector dispatchers;
{
std::lock_guard lock(g_failedImageBrushesRegistryMutex);
for (auto& weakDispatcher : g_failedImageBrushesRegistry) {
if (auto dispatcher = weakDispatcher.get()) {
dispatchers.push_back(dispatcher);
}
}
// Clean up dead weak refs.
std::erase_if(
g_failedImageBrushesRegistry,
[](const auto& weakDispatcher) { return !weakDispatcher.get(); });
}
// Dispatch retry to each UI thread.
for (auto& dispatcher : dispatchers) {
try {
dispatcher.TryEnqueue(
[]() { RetryFailedImageLoadsOnCurrentThread(); });
} catch (winrt::hresult_error const& ex) {
Wh_Log(L"Error dispatching retry to UI thread %08X: %s", ex.code(),
ex.message().c_str());
}
}
}
void RemoveFromFailedImageBrushes(Media::ImageBrush const& brush) {
auto& failedImageBrushes = g_failedImageBrushesForThread.failedImageBrushes;
std::erase_if(failedImageBrushes, [&brush](const auto& info) {
if (auto existingBrush = info.brush.get()) {
return existingBrush == brush;
}
return false;
});
}
void SetupImageBrushTracking(Media::ImageBrush const& brush,
winrt::hstring const& imageSourceUrl) {
// First remove any existing entry for this brush to avoid duplicates.
RemoveFromFailedImageBrushes(brush);
// Add new entry with event handlers.
ImageBrushFailedLoadInfo info;
info.brush = winrt::make_weak(brush);
info.imageSource = imageSourceUrl;
// Set up ImageFailed event handler - add to list only when load fails.
info.imageFailedRevoker = brush.ImageFailed(
winrt::auto_revoke,
[brushWeak = winrt::make_weak(brush), imageSourceUrl](
winrt::Windows::Foundation::IInspectable const& sender,
ExceptionRoutedEventArgs const& e) {
Wh_Log(L"ImageBrush load failed for: %s, error: %s",
imageSourceUrl.c_str(), e.ErrorMessage().c_str());
// The brush should already be in the list, no action needed here as
// we add it preemptively in SetupImageBrushTracking.
});
// Set up ImageOpened event handler - remove from list when load succeeds.
info.imageOpenedRevoker = brush.ImageOpened(
winrt::auto_revoke,
[brushWeak = winrt::make_weak(brush)](
winrt::Windows::Foundation::IInspectable const& sender,
RoutedEventArgs const& e) {
Wh_Log(L"ImageBrush loaded successfully, removing from retry list");
if (auto brush = brushWeak.get()) {
RemoveFromFailedImageBrushes(brush);
}
});
// Add to the list preemptively - will be removed if load succeeds.
auto& failedImageBrushes = g_failedImageBrushesForThread.failedImageBrushes;
failedImageBrushes.push_back(std::move(info));
// Ensure we have a dispatcher for this thread.
if (!g_failedImageBrushesForThread.dispatcher) {
try {
g_failedImageBrushesForThread.dispatcher =
winrt::Windows::System::DispatcherQueue::GetForCurrentThread();
if (g_failedImageBrushesForThread.dispatcher) {
// Register this thread's dispatcher globally.
std::lock_guard lock(
g_failedImageBrushesRegistryMutex);
g_failedImageBrushesRegistry.push_back(
winrt::make_weak(g_failedImageBrushesForThread.dispatcher));
Wh_Log(L"Registered UI thread dispatcher for network retry");
}
} catch (winrt::hresult_error const& ex) {
Wh_Log(L"Error getting dispatcher for current thread %08X: %s",
ex.code(), ex.message().c_str());
}
}
// Register global network status changed handler if not already registered.
// This is a one-time global registration.
[[maybe_unused]] static bool networkHandlerRegistered = []() {
try {
g_networkStatusChangedToken =
winrt::Windows::Networking::Connectivity::NetworkInformation::
NetworkStatusChanged(OnNetworkStatusChanged);
Wh_Log(L"Registered global network status change handler");
} catch (winrt::hresult_error const& ex) {
Wh_Log(L"Error registering network status handler %08X: %s",
ex.code(), ex.message().c_str());
}
return true;
}();
}
void SetOrClearValue(DependencyObject elementDo,
DependencyProperty property,
const PropertyOverrideValue& overrideValue) {
winrt::Windows::Foundation::IInspectable value;
if (auto* inspectable =
std::get_if(
&overrideValue)) {
value = *inspectable;
} else if (auto* blurBrushParams =
std::get_if(&overrideValue)) {
if (auto uiElement = elementDo.try_as()) {
auto compositor =
wuxh::ElementCompositionPreview::GetElementVisual(uiElement)
.Compositor();
value = winrt::make(
std::move(compositor), blurBrushParams->blurAmount,
blurBrushParams->tint, blurBrushParams->tintOpacity,
winrt::hstring(blurBrushParams->tintThemeResourceKey));
} else {
Wh_Log(L"Can't get UIElement for blur brush");
return;
}
} else {
Wh_Log(L"Unsupported override value");
return;
}
if (value == DependencyProperty::UnsetValue()) {
elementDo.ClearValue(property);
return;
}
// Track ImageBrush with remote ImageSource for retry on network
// reconnection. This handles cases where an ImageBrush is set as a property
// value (e.g., Background).
if (auto imageBrush = value.try_as()) {
auto imageSource = imageBrush.ImageSource();
if (auto bitmapImage =
imageSource.try_as()) {
auto uriSource = bitmapImage.UriSource();
if (uriSource) {
winrt::hstring uriString = uriSource.ToString();
if (uriString.starts_with(L"https://") ||
uriString.starts_with(L"http://")) {
Wh_Log(L"Tracking ImageBrush with remote source: %s",
uriString.c_str());
SetupImageBrushTracking(imageBrush, uriString);
}
}
}
}
// Also handle direct ImageSource property being set on an ImageBrush.
else if (auto imageBrush = elementDo.try_as()) {
if (property == Media::ImageBrush::ImageSourceProperty()) {
// Check if the value is a BitmapImage with an http(s):// URI.
if (auto bitmapImage =
value.try_as()) {
auto uriSource = bitmapImage.UriSource();
if (uriSource) {
winrt::hstring uriString = uriSource.ToString();
if (uriString.starts_with(L"https://") ||
uriString.starts_with(L"http://")) {
Wh_Log(
L"Tracking ImageBrush ImageSource property with "
L"remote source: %s",
uriString.c_str());
SetupImageBrushTracking(imageBrush, uriString);
}
}
}
}
}
// This might fail. See `ReadLocalValueWithWorkaround` for an example (which
// we now handle but there might be other cases).
try {
// `setter.Value()` returns font weight as an int. Using it with
// `SetValue` results in the following error: 0x80004002 (No such
// interface supported). Box it as `Windows.UI.Text.FontWeight` as a
// workaround.
if (property == Controls::TextBlock::FontWeightProperty() ||
property == Controls::Control::FontWeightProperty()) {
auto valueInt = value.try_as();
if (valueInt && *valueInt >= std::numeric_limits::min() &&
*valueInt <= std::numeric_limits::max()) {
value = winrt::box_value(winrt::Windows::UI::Text::FontWeight{
static_cast(*valueInt)});
}
}
elementDo.SetValue(property, value);
} catch (winrt::hresult_error const& ex) {
Wh_Log(L"Error %08X: %s", ex.code(), ex.message().c_str());
}
}
// https://stackoverflow.com/a/5665377
std::wstring EscapeXmlAttribute(std::wstring_view data) {
std::wstring buffer;
buffer.reserve(data.size());
for (const auto c : data) {
switch (c) {
case '&':
buffer.append(L"&");
break;
case '\"':
buffer.append(L""");
break;
// case '\'':
// buffer.append(L"'");
// break;
case '<':
buffer.append(L"<");
break;
case '>':
buffer.append(L">");
break;
default:
buffer.push_back(c);
break;
}
}
return buffer;
}
// https://stackoverflow.com/a/54364173
std::wstring_view TrimStringView(std::wstring_view s) {
s.remove_prefix(std::min(s.find_first_not_of(L" \t\r\v\n"), s.size()));
s.remove_suffix(
std::min(s.size() - s.find_last_not_of(L" \t\r\v\n") - 1, s.size()));
return s;
}
// https://stackoverflow.com/a/46931770
std::vector SplitStringView(std::wstring_view s,
std::wstring_view delimiter) {
size_t pos_start = 0, pos_end, delim_len = delimiter.length();
std::wstring_view token;
std::vector res;
while ((pos_end = s.find(delimiter, pos_start)) !=
std::wstring_view::npos) {
token = s.substr(pos_start, pos_end - pos_start);
pos_start = pos_end + delim_len;
res.push_back(token);
}
res.push_back(s.substr(pos_start));
return res;
}
std::optional ParseNonXamlPropertyOverrideValue(
std::wstring_view stringValue) {
// Example:
//
auto substr = TrimStringView(stringValue);
constexpr auto kWindhawkBlurPrefix = L"(substr.length()), substr.data());
substr = substr.substr(std::size(kWindhawkBlurPrefix));
constexpr auto kWindhawkBlurSuffix = L"/>"sv;
if (!substr.ends_with(kWindhawkBlurSuffix)) {
throw std::runtime_error("WindhawkBlur: Bad suffix");
}
substr = substr.substr(0, substr.size() - std::size(kWindhawkBlurSuffix));
bool pendingTintColorThemeResource = false;
std::wstring tintThemeResourceKey;
winrt::Windows::UI::Color tint{};
float tintOpacity = std::numeric_limits::quiet_NaN();
float blurAmount = 0;
constexpr auto kTintColorThemeResourcePrefix =
L"TintColor=\"{ThemeResource"sv;
constexpr auto kTintColorThemeResourceSuffix = L"}\""sv;
constexpr auto kTintColorPrefix = L"TintColor=\"#"sv;
constexpr auto kTintOpacityPrefix = L"TintOpacity=\""sv;
constexpr auto kBlurAmountPrefix = L"BlurAmount=\""sv;
for (const auto prop : SplitStringView(substr, L" ")) {
const auto propSubstr = TrimStringView(prop);
if (propSubstr.empty()) {
continue;
}
Wh_Log(L" %.*s", static_cast(propSubstr.length()),
propSubstr.data());
if (pendingTintColorThemeResource) {
if (!propSubstr.ends_with(kTintColorThemeResourceSuffix)) {
throw std::runtime_error(
"WindhawkBlur: Invalid TintColor theme resource syntax");
}
pendingTintColorThemeResource = false;
tintThemeResourceKey = propSubstr.substr(
0,
propSubstr.size() - std::size(kTintColorThemeResourceSuffix));
continue;
}
if (propSubstr == kTintColorThemeResourcePrefix) {
pendingTintColorThemeResource = true;
continue;
}
if (propSubstr.starts_with(kTintColorPrefix) &&
propSubstr.back() == L'\"') {
auto valStr = propSubstr.substr(
std::size(kTintColorPrefix),
propSubstr.size() - std::size(kTintColorPrefix) - 1);
bool hasAlpha;
switch (valStr.size()) {
case 6:
hasAlpha = false;
break;
case 8:
hasAlpha = true;
break;
default:
throw std::runtime_error(
"WindhawkBlur: Unsupported TintColor value");
}
auto valNum = std::stoul(std::wstring(valStr), nullptr, 16);
uint8_t a = hasAlpha ? HIBYTE(HIWORD(valNum)) : 255;
uint8_t r = LOBYTE(HIWORD(valNum));
uint8_t g = HIBYTE(LOWORD(valNum));
uint8_t b = LOBYTE(LOWORD(valNum));
tint = {a, r, g, b};
continue;
}
if (propSubstr.starts_with(kTintOpacityPrefix) &&
propSubstr.back() == L'\"') {
auto valStr = propSubstr.substr(
std::size(kTintOpacityPrefix),
propSubstr.size() - std::size(kTintOpacityPrefix) - 1);
tintOpacity = std::stof(std::wstring(valStr));
continue;
}
if (propSubstr.starts_with(kBlurAmountPrefix) &&
propSubstr.back() == L'\"') {
auto valStr = propSubstr.substr(
std::size(kBlurAmountPrefix),
propSubstr.size() - std::size(kBlurAmountPrefix) - 1);
blurAmount = std::stof(std::wstring(valStr));
continue;
}
throw std::runtime_error("WindhawkBlur: Bad property");
}
if (pendingTintColorThemeResource) {
throw std::runtime_error(
"WindhawkBlur: Unterminated TintColor theme resource");
}
if (!std::isnan(tintOpacity)) {
if (tintOpacity < 0.0f) {
tintOpacity = 0.0f;
} else if (tintOpacity > 1.0f) {
tintOpacity = 1.0f;
}
tint.A = static_cast(tintOpacity * 255.0f);
}
return XamlBlurBrushParams{
.blurAmount = blurAmount,
.tint = tint,
.tintOpacity =
!std::isnan(tintOpacity) ? std::optional(tint.A) : std::nullopt,
.tintThemeResourceKey = std::move(tintThemeResourceKey),
};
}
Style GetStyleFromXamlSetters(const std::wstring_view type,
const std::wstring_view xamlStyleSetters) {
std::wstring xaml =
LR"(\n"
L" \n"
L"";
Wh_Log(L"======================================== XAML:");
std::wstringstream ss(xaml);
std::wstring line;
while (std::getline(ss, line, L'\n')) {
Wh_Log(L"%s", line.c_str());
}
Wh_Log(L"========================================");
auto resourceDictionary =
Markup::XamlReader::Load(xaml).as();
auto [styleKey, styleInspectable] = resourceDictionary.First().Current();
return styleInspectable.as