Normal Mica on taskbar (Win11)
Oct 28, 2023 11:27:22 GMT -8
Post by anixx on Oct 28, 2023 11:27:22 GMT -8
Found this mod on Windhawk discord:
// ==WindhawkMod==
// @id not-tabbed
// @name Not tabbed Mica, normal Mica
// @description Enforce usage of normal Mica, not Tabbed
// @version 0.1
// @author reabstraction
// @github https://github.com/nat
// @twitter https://twitter.com/jack
// @homepage https://your-personal-homepage.example.com/
// @include explorer.exe
// @compilerOptions -ldwmapi -DWINVER=0x0A00
// ==/WindhawkMod==
// ==WindhawkModReadme==
/*
Hooks `DwmSetWindowAttribute` to make normal Mica used over tabbed Mica
Gives a lighter feel to the OS
*/
// ==/WindhawkModReadme==
#include <dwmapi.h>
#include <Windows.h>
#include <minwindef.h>
#include <windhawk_utils.h>
enum FIXED_DWMWINDOWATTRIBUTE {
FIXED_DWMWA_NCRENDERING_ENABLED,
FIXED_DWMWA_NCRENDERING_POLICY,
FIXED_DWMWA_TRANSITIONS_FORCEDISABLED,
FIXED_DWMWA_ALLOW_NCPAINT,
FIXED_DWMWA_CAPTION_BUTTON_BOUNDS,
FIXED_DWMWA_NONCLIENT_RTL_LAYOUT,
FIXED_DWMWA_FORCE_ICONIC_REPRESENTATION,
FIXED_DWMWA_FLIP3D_POLICY,
FIXED_DWMWA_EXTENDED_FRAME_BOUNDS,
FIXED_DWMWA_HAS_ICONIC_BITMAP,
FIXED_DWMWA_DISALLOW_PEEK,
FIXED_DWMWA_EXCLUDED_FROM_PEEK,
FIXED_DWMWA_CLOAK,
FIXED_DWMWA_CLOAKED,
FIXED_DWMWA_FREEZE_REPRESENTATION,
FIXED_DWMWA_PASSIVE_UPDATE_MODE,
FIXED_DWMWA_USE_HOSTBACKDROPBRUSH,
FIXED_DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
FIXED_DWMWA_WINDOW_CORNER_PREFERENCE = 33,
FIXED_DWMWA_BORDER_COLOR,
FIXED_DWMWA_CAPTION_COLOR,
FIXED_DWMWA_TEXT_COLOR,
FIXED_DWMWA_VISIBLE_FRAME_BORDER_THICKNESS,
FIXED_DWMWA_SYSTEMBACKDROP_TYPE,
FIXED_DWMWA_LAST
} ;
enum FIXED_DWM_SYSTEMBACKDROP_TYPE {
FIXED_DWMSBT_AUTO,
FIXED_DWMSBT_NONE,
FIXED_DWMSBT_MAINWINDOW,
FIXED_DWMSBT_TRANSIENTWINDOW,
FIXED_DWMSBT_TABBEDWINDOW
};
using DwmSetWindowAttribute_t = decltype(&DwmSetWindowAttribute);
DwmSetWindowAttribute_t DwmSetWindowAttribute_orig = NULL;
HRESULT WINAPI DwmSetWindowAttribute_hook(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute) {
if (dwAttribute == FIXED_DWMWA_SYSTEMBACKDROP_TYPE) {
Wh_Log(L"Apply normal Mica");
int value = FIXED_DWMSBT_MAINWINDOW;
return DwmSetWindowAttribute_orig(hwnd, dwAttribute, &value, sizeof(value));
}
return DwmSetWindowAttribute_orig(hwnd, dwAttribute, pvAttribute, cbAttribute);
}
BOOL Wh_ModInit() {
HMODULE dwmapi = LoadLibraryW(L"dwmapi.dll");
if (dwmapi) {
DwmSetWindowAttribute_orig = (DwmSetWindowAttribute_t)GetProcAddress(dwmapi, "DwmSetWindowAttribute");
if (DwmSetWindowAttribute_orig) {
BOOL hookResult = Wh_SetFunctionHook((void*)DwmSetWindowAttribute_orig, (void*)DwmSetWindowAttribute_hook, (void**)&DwmSetWindowAttribute_orig);
if (!hookResult) {
return FALSE;
}
}
FreeLibrary(dwmapi);
}
return TRUE;
}