Skip to content

Commit 7babeba

Browse files
authored
Customize Windows notifications placement v1.2.3 (#4842)
* Fixed compatibility of the animation direction option with recent Windows 11 versions.
1 parent 9844dd6 commit 7babeba

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

mods/notifications-placement.wh.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// @id notifications-placement
33
// @name Customize Windows notifications placement
44
// @description Move notifications to another monitor or another corner of the screen
5-
// @version 1.2.2
5+
// @version 1.2.3
66
// @author m417z
77
// @github https://github.com/m417z
88
// @twitter https://twitter.com/m417z
99
// @homepage https://m417z.com/
1010
// @include explorer.exe
1111
// @include ShellExperienceHost.exe
1212
// @architecture x86-64
13-
// @compilerOptions -DWINVER=0x0A00 -lole32 -loleaut32 -lruntimeobject -lshcore
13+
// @compilerOptions -lole32 -loleaut32 -lruntimeobject -lshcore
1414
// ==/WindhawkMod==
1515

1616
// Source code is published under The GNU General Public License v3.0.
@@ -366,7 +366,7 @@ bool IsTargetCoreWindow(HWND hWnd) {
366366
L"Ný tilkynning", // IS-IS
367367
L"ახალი შეტყობინება", // KA-GE
368368
L"Жаңа хабарландыру", // KK-KZ
369-
L"ការ​ជូន​ដំណឹង​ថ្មី", // KM-KH
369+
L"ការ\u200bជូន\u200bដំណឹង\u200bថ្មី", // KM-KH
370370
L"ಹೊಸ ಪ್ರಕಟಣೆ", // KN-IN
371371
L"नवी अधिसुचोवणी", // KOK-IN
372372
L"Nei Notifikatioun", // LB-LU
@@ -736,18 +736,21 @@ void UpdateAnimationDirectionStyle() {
736736
return false; // continue enumeration
737737
}
738738

739-
FrameworkElement revealGrid2 =
740-
FindChildByName(mainGrid, L"RevealGrid2");
741-
if (!revealGrid2) {
742-
return false; // continue enumeration
739+
FrameworkElement revealGrid = FindChildByName(mainGrid, L"RevealGrid");
740+
if (!revealGrid) {
741+
// Older Windows 11 versions use this name (before ~Jul 2026).
742+
revealGrid = FindChildByName(mainGrid, L"RevealGrid2");
743+
if (!revealGrid) {
744+
return false; // continue enumeration
745+
}
743746
}
744747

745748
Wh_Log(L"Applying transform to toast view %s", name.c_str());
746749

747750
Media::RotateTransform transform;
748751
transform.Angle(-angle);
749-
revealGrid2.RenderTransform(transform);
750-
revealGrid2.RenderTransformOrigin(origin);
752+
revealGrid.RenderTransform(transform);
753+
revealGrid.RenderTransformOrigin(origin);
751754

752755
foundAnyRootGridContent = true;
753756
return false; // continue enumeration to find all matching children
@@ -927,7 +930,7 @@ BOOL Wh_ModInit() {
927930
case 0:
928931
case ARRAYSIZE(moduleFilePath):
929932
Wh_Log(L"GetModuleFileName failed");
930-
break;
933+
return FALSE;
931934

932935
default:
933936
if (PCWSTR moduleFileName = wcsrchr(moduleFilePath, L'\\')) {
@@ -937,6 +940,7 @@ BOOL Wh_ModInit() {
937940
}
938941
} else {
939942
Wh_Log(L"GetModuleFileName returned an unsupported path");
943+
return FALSE;
940944
}
941945
break;
942946
}
@@ -949,9 +953,8 @@ BOOL Wh_ModInit() {
949953
return FALSE;
950954
}
951955

952-
WindhawkUtils::Wh_SetFunctionHookT(MonitorFromPoint,
953-
MonitorFromPoint_Hook,
954-
&MonitorFromPoint_Original);
956+
WindhawkUtils::SetFunctionHook(MonitorFromPoint, MonitorFromPoint_Hook,
957+
&MonitorFromPoint_Original);
955958
}
956959

957960
return TRUE;

0 commit comments

Comments
 (0)