Skip to content

Commit 969985c

Browse files
authored
Windows 11 Taskbar Styler v1.3.10 (#1561)
* Improved support for the new thumbnail previews implementation in Windows 11 for the following themes: WinXP, TranslucentTaskbar, Squircle, RosePine, DockLike, CleanSlate, Lucent. * Fixed customizing the FontWeight property for some controls.
1 parent 6e4b334 commit 969985c

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

mods/windows-11-taskbar-styler.wh.cpp

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @id windows-11-taskbar-styler
33
// @name Windows 11 Taskbar Styler
44
// @description Customize the taskbar with themes contributed by others or create your own
5-
// @version 1.3.9
5+
// @version 1.3.10
66
// @author m417z
77
// @github https://github.com/m417z
88
// @twitter https://twitter.com/m417z
@@ -262,6 +262,8 @@ const Theme g_themeWinXP = {{
262262
L"Fill:=<LinearGradientBrush StartPoint=\"0.5,0\" EndPoint=\"0.5,1\"> <GradientStop Color=\"#3168d5\" Offset=\"0.0\" /> <GradientStop Color=\"#4993E6\" Offset=\"0.1\" /> <GradientStop Color=\"#2157D7\" Offset=\"0.35\" /> <GradientStop Color=\"#2663E0\" Offset=\"0.8\" /> <GradientStop Color=\"#1941A5\" Offset=\"1.0\" /></LinearGradientBrush>",
263263
L"VerticalAlignment=Stretch",
264264
L"Height=Auto"}},
265+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
266+
L"Fill:=<LinearGradientBrush StartPoint=\"0.5,0\" EndPoint=\"0.5,1\"> <GradientStop Color=\"#3168d5\" Offset=\"0.0\" /> <GradientStop Color=\"#4993E6\" Offset=\"0.1\" /> <GradientStop Color=\"#2157D7\" Offset=\"0.35\" /> <GradientStop Color=\"#2663E0\" Offset=\"0.8\" /> <GradientStop Color=\"#1941A5\" Offset=\"1.0\" /></LinearGradientBrush>"}},
265267
ThemeTargetStyles{L"Taskbar.ExperienceToggleButton#LaunchListButton[AutomationProperties.AutomationId=StartButton]", {
266268
L"CornerRadius=0",
267269
L"Margin=0,0,4,0",
@@ -377,8 +379,10 @@ const Theme g_themeBubbles = {{
377379
}};
378380

379381
const Theme g_themeTranslucentTaskbar = {{
380-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
382+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
381383
L"Fill:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0\" TintLuminosityOpacity=\"0.15\" Opacity=\"1\" FallbackColor=\"#70262626\"/>"}},
384+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
385+
L"Fill=#C444"}},
382386
ThemeTargetStyles{L"Rectangle#BackgroundStroke", {
383387
L"Visibility=Collapsed"}},
384388
ThemeTargetStyles{L"MenuFlyoutPresenter", {
@@ -394,8 +398,10 @@ const Theme g_themeTranslucentTaskbar = {{
394398
}};
395399

396400
const Theme g_themeSquircle = {{
397-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
401+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
398402
L"Fill=Transparent"}},
403+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
404+
L"Fill=#CC222222"}},
399405
ThemeTargetStyles{L"Taskbar.TaskListButtonPanel@CommonStates > Border#BackgroundElement", {
400406
L"CornerRadius=5",
401407
L"Background:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0.8\" FallbackColor=\"#BB222222\" />",
@@ -467,11 +473,13 @@ const Theme g_themeSquircle = {{
467473
}};
468474

469475
const Theme g_themeSquircle_variant_WeatherOnTheRight = {{
470-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
476+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
471477
L"Fill=Transparent"}},
478+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
479+
L"Fill=#CC222222"}},
472480
ThemeTargetStyles{L"Taskbar.TaskListButtonPanel@CommonStates > Border#BackgroundElement", {
473481
L"CornerRadius=5",
474-
L"Background:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0.8\" FallbackColor=\"#BB222222\"/>",
482+
L"Background:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0.8\" FallbackColor=\"#BB222222\" />",
475483
L"Background@InactivePointerOver:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0.8\" FallbackColor=\"#CC222222\" />",
476484
L"Background@ActivePointerOver:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0.8\" FallbackColor=\"#CC222222\" />",
477485
L"Background@ActiveNormal:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0.8\" FallbackColor=\"#CC222222\" />",
@@ -595,8 +603,10 @@ const Theme g_themeRosePine = {{
595603
L"Visibility=Collapsed"}},
596604
ThemeTargetStyles{L"Windows.UI.Xaml.Controls.TextBlock#InnerTextBlock[Text=\uE971]", {
597605
L"Text=\uE712"}},
598-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
606+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
599607
L"Fill=Transparent"}},
608+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
609+
L"Fill=#302d47"}},
600610
ThemeTargetStyles{L"Rectangle#BackgroundStroke", {
601611
L"Fill=Transparent"}},
602612
ThemeTargetStyles{L"Taskbar.TaskListButtonPanel#ExperienceToggleButtonRootPanel > Border#BackgroundElement", {
@@ -617,7 +627,7 @@ const Theme g_themeDockLike = {{
617627
L"Padding=6,0,6,0",
618628
L"CornerRadius=8,8,0,0",
619629
L"BorderBrush:=<SolidColorBrush Color=\"{ThemeResource SurfaceStrokeColorDefault}\" />"}},
620-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
630+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
621631
L"Visibility=Collapsed"}},
622632
ThemeTargetStyles{L"Rectangle#BackgroundStroke", {
623633
L"Visibility=Collapsed"}},
@@ -708,7 +718,7 @@ const Theme g_themeWinVista = {{
708718
}};
709719

710720
const Theme g_themeCleanSlate = {{
711-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
721+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
712722
L"Fill:=<AcrylicBrush TintColor=\"{ThemeResource SystemAccentColorDark2}\" TintOpacity=\"0.4\" FallbackColor=\"{ThemeResource SystemAccentColorDark1}\" />"}},
713723
ThemeTargetStyles{L"Taskbar.TaskListButtonPanel@CommonStates > Border#BackgroundElement", {
714724
L"CornerRadius=100",
@@ -789,8 +799,10 @@ const Theme g_themeCleanSlate = {{
789799
}};
790800

791801
const Theme g_themeLucent = {{
792-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
802+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
793803
L"Fill:=<LinearGradientBrush StartPoint=\"0,0\" EndPoint=\"0,1\"><GradientStop Color=\"#00000000\" Offset=\"0.3\" /><GradientStop Color=\"#AA000000\" Offset=\"0.9\" /></LinearGradientBrush>"}},
804+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
805+
L"Fill:=<LinearGradientBrush StartPoint=\"0,0.5\" EndPoint=\"0,1\"><GradientStop Color=\"#ee000000\" Offset=\"0.1\" /><GradientStop Color=\"{ThemeResource SystemAccentColorDark2}\" Offset=\"0.9\" /><GradientStop Color=\"#AAFFFFFF\" Offset=\"1.0\" /></LinearGradientBrush>"}},
794806
ThemeTargetStyles{L"Taskbar.TaskListLabeledButtonPanel@RunningIndicatorStates > Rectangle#RunningIndicator", {
795807
L"Fill=Transparent"}},
796808
ThemeTargetStyles{L"Rectangle#BackgroundStroke", {
@@ -830,8 +842,10 @@ const Theme g_themeLucent = {{
830842
}};
831843

832844
const Theme g_themeLucent_variant_Light = {{
833-
ThemeTargetStyles{L"Rectangle#BackgroundFill", {
845+
ThemeTargetStyles{L"Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill", {
834846
L"Fill:=<LinearGradientBrush StartPoint=\"0,0\" EndPoint=\"0,1\"><GradientStop Color=\"#00000000\" Offset=\"0.3\" /><GradientStop Color=\"#AA000000\" Offset=\"0.9\" /></LinearGradientBrush>"}},
847+
ThemeTargetStyles{L"Taskbar.TaskbarBackground#HoverFlyoutBackgroundControl > Grid > Rectangle#BackgroundFill", {
848+
L"Fill:=<LinearGradientBrush StartPoint=\"0,0.5\" EndPoint=\"0,1\"><GradientStop Color=\"#ee000000\" Offset=\"0.1\" /><GradientStop Color=\"{ThemeResource SystemAccentColorDark2}\" Offset=\"0.9\" /><GradientStop Color=\"#AAFFFFFF\" Offset=\"1.0\" /></LinearGradientBrush>"}},
835849
ThemeTargetStyles{L"Taskbar.TaskListLabeledButtonPanel@RunningIndicatorStates > Rectangle#RunningIndicator", {
836850
L"Fill=Transparent"}},
837851
ThemeTargetStyles{L"Rectangle#BackgroundStroke", {
@@ -1518,7 +1532,8 @@ void SetOrClearValue(DependencyObject elementDo,
15181532
// `SetValue` results in the following error: 0x80004002 (No such
15191533
// interface supported). Box it as `Windows.UI.Text.FontWeight` as a
15201534
// workaround.
1521-
if (property == Controls::TextBlock::FontWeightProperty()) {
1535+
if (property == Controls::TextBlock::FontWeightProperty() ||
1536+
property == Controls::Control::FontWeightProperty()) {
15221537
auto valueInt = value.try_as<int>();
15231538
if (valueInt && *valueInt >= std::numeric_limits<uint16_t>::min() &&
15241539
*valueInt <= std::numeric_limits<uint16_t>::max()) {
@@ -1839,7 +1854,9 @@ bool TestElementMatcher(FrameworkElement element,
18391854
auto elementDo = element.as<DependencyObject>();
18401855

18411856
for (const auto& propertyValue : GetResolvedPropertyValues(
1842-
matcher.type, fallbackClassName ? fallbackClassName : L"",
1857+
matcher.type,
1858+
fallbackClassName ? fallbackClassName
1859+
: winrt::name_of<FrameworkElement>(),
18431860
&matcher.propertyValues)) {
18441861
const auto value =
18451862
ReadLocalValueWithWorkaround(elementDo, propertyValue.first);
@@ -1941,7 +1958,8 @@ FindElementPropertyOverrides(FrameworkElement element,
19411958
for (const auto& [property, valuesPerVisualState] :
19421959
GetResolvedPropertyOverrides(
19431960
override.elementMatcher.type,
1944-
fallbackClassName ? fallbackClassName : L"",
1961+
fallbackClassName ? fallbackClassName
1962+
: winrt::name_of<FrameworkElement>(),
19451963
&override.propertyOverrides)) {
19461964
bool propertyInserted = propertiesAdded.insert(property).second;
19471965
if (!propertyInserted) {
@@ -2202,7 +2220,7 @@ void ApplyCustomizations(InstanceHandle handle,
22022220
UINT uMsg, // WM_TIMER message
22032221
UINT_PTR idEvent, // timer identifier
22042222
DWORD dwTime // current system time
2205-
) WINAPI {
2223+
) {
22062224
Wh_Log(L"Running delayed customization of BackgroundFill");
22072225

22082226
for (auto it = g_backgroundFillDelayedApplyData.begin();
@@ -2755,7 +2773,7 @@ bool RunFromWindowThread(HWND hWnd,
27552773

27562774
HHOOK hook = SetWindowsHookEx(
27572775
WH_CALLWNDPROC,
2758-
[](int nCode, WPARAM wParam, LPARAM lParam) WINAPI -> LRESULT {
2776+
[](int nCode, WPARAM wParam, LPARAM lParam) -> LRESULT {
27592777
if (nCode == HC_ACTION) {
27602778
const CWPSTRUCT* cwp = (const CWPSTRUCT*)lParam;
27612779
if (cwp->message == runFromWindowThreadRegisteredMsg) {
@@ -2813,8 +2831,7 @@ void Wh_ModAfterInit() {
28132831
if (hTaskbarUiWnd) {
28142832
Wh_Log(L"Initializing - Found DesktopWindowContentBridge window");
28152833
RunFromWindowThread(
2816-
hTaskbarUiWnd, [](PVOID) WINAPI { InitializeSettingsAndTap(); },
2817-
nullptr);
2834+
hTaskbarUiWnd, [](PVOID) { InitializeSettingsAndTap(); }, nullptr);
28182835
}
28192836
}
28202837

@@ -2830,7 +2847,7 @@ void Wh_ModUninit() {
28302847
if (hTaskbarUiWnd) {
28312848
Wh_Log(L"Uninitializing - Found DesktopWindowContentBridge window");
28322849
RunFromWindowThread(
2833-
hTaskbarUiWnd, [](PVOID) WINAPI { UninitializeSettingsAndTap(); },
2850+
hTaskbarUiWnd, [](PVOID) { UninitializeSettingsAndTap(); },
28342851
nullptr);
28352852
}
28362853
}
@@ -2848,7 +2865,7 @@ void Wh_ModSettingsChanged() {
28482865
Wh_Log(L"Reinitializing - Found DesktopWindowContentBridge window");
28492866
RunFromWindowThread(
28502867
hTaskbarUiWnd,
2851-
[](PVOID) WINAPI {
2868+
[](PVOID) {
28522869
UninitializeSettingsAndTap();
28532870
InitializeSettingsAndTap();
28542871
},

0 commit comments

Comments
 (0)