Skip to content

Commit

Permalink
File Explorer: Restored "Apply Mica" functionality on 22H2
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrsatrio committed Nov 12, 2023
1 parent 2dc1340 commit f62c532
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion ExplorerPatcher-L10N
16 changes: 12 additions & 4 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -3898,20 +3898,28 @@ HWND WINAPI explorerframe_SHCreateWorkerWindowHook(
{
SetWindowSubclass(hWndParent, HideIconAndTitleInExplorerSubClass, HideIconAndTitleInExplorerSubClass, 0);
}
if (bMicaEffectOnTitlebar)
if ((!bIsExplorerProcess || dwFileExplorerCommandUI == 2) && bMicaEffectOnTitlebar)
{
SetWindowSubclass(result, ExplorerMicaTitlebarSubclassProc, ExplorerMicaTitlebarSubclassProc, bMicaEffectOnTitlebar);
}
if (bHideExplorerSearchBar)
{
SetWindowSubclass(hWndParent, HideExplorerSearchBarSubClass, HideExplorerSearchBarSubClass, 0);
}
if (IsWindows11Version22H2OrHigher())
if (bIsExplorerProcess && dwFileExplorerCommandUI != 0 && IsWindows11Version22H2OrHigher())
{
// Fix initial title bar style after disabling TIFE
// If we don't do this, it will only fix itself once the user changes the system color scheme or toggling transparency effects
BOOL value = ShouldAppsUseDarkMode();
DwmSetWindowAttribute(hWndParent, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(BOOL));
if (!ShouldAppsUseDarkMode)
{
HANDLE hUxtheme = LoadLibraryW(L"uxtheme.dll");
ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x84);
}
if (ShouldAppsUseDarkMode)
{
BOOL value = ShouldAppsUseDarkMode();
DwmSetWindowAttribute(hWndParent, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(BOOL));
}
}
}
return result;
Expand Down
7 changes: 4 additions & 3 deletions ep_gui/GUI.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ LSTATUS GUI_Internal_RegSetValueExW(
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_FileExplorerCommandUI"))
{
if (!*(DWORD*)lpData)
DWORD dwValue = *(DWORD*)lpData;
if (dwValue == 0 || dwValue == 3 || dwValue == 4) // This no longer has any effect on 22H2
{
RegDeleteTreeW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}");
}
Expand Down Expand Up @@ -724,12 +725,12 @@ LSTATUS GUI_Internal_RegQueryValueExW(
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_FileExplorerCommandUI"))
{
if (RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\InProcServer32", L"", RRF_RT_REG_SZ, NULL, NULL, NULL) != ERROR_SUCCESS)
/*if (RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\InProcServer32", L"", RRF_RT_REG_SZ, NULL, NULL, NULL) != ERROR_SUCCESS)
{
*lpcbData = sizeof(DWORD);
*(DWORD*)lpData = 0;
return ERROR_SUCCESS;
}
}*/
return RegQueryValueExW(hKey, L"FileExplorerCommandUI", lpReserved, lpType, lpData, lpcbData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_RegisterAsShellExtension"))
Expand Down
37 changes: 17 additions & 20 deletions ep_gui/resources/EPSettingsResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,23 @@
#define IDS_EXP_CLASSICDRIVEGROUP 1208
#define IDS_EXP_CTRLINTF 1209
#define IDS_EXP_CTRLINTF_0_W11 1210
#define IDS_EXP_CTRLINTF_0_W10 1211
#define IDS_EXP_CTRLINTF_1_W11 1212
#define IDS_EXP_CTRLINTF_2 1213
#define IDS_EXP_NEWWINDOWS 1214
#define IDS_EXP_IMMERSIVEMENUS 1215
#define IDS_EXP_DISABLENAVBAR 1216
#define IDS_EXP_DISABLESEARCHBAR 1217
#define IDS_EXP_SHRINKADDRESSBAR 1218
#define IDS_EXP_HIDESEARCHBAR 1219
#define IDS_EXP_TITLEBAR 1220
#define IDS_EXP_TITLEBAR_0 1221
#define IDS_EXP_TITLEBAR_1 1222
#define IDS_EXP_TITLEBAR_2 1223
#define IDS_EXP_TITLEBAR_3 1224
#define IDS_EXP_MICA 1225
#define IDS_EXP_MICA_0 1226
#define IDS_EXP_MICA_1 1227
#define IDS_EXP_MICA_2 1228
#define IDS_EXP_CTRLINTF_3 1229
#define IDS_EXP_CTRLINTF_4 1230
#define IDS_EXP_CTRLINTF_3 1211
#define IDS_EXP_CTRLINTF_4 1212
#define IDS_EXP_CTRLINTF_0_W10 1213
#define IDS_EXP_CTRLINTF_1_W11 1214
#define IDS_EXP_CTRLINTF_2 1215
#define IDS_EXP_NEWWINDOWS 1216
#define IDS_EXP_IMMERSIVEMENUS 1217
#define IDS_EXP_DISABLENAVBAR 1218
#define IDS_EXP_DISABLESEARCHBAR 1219
#define IDS_EXP_SHRINKADDRESSBAR 1220
#define IDS_EXP_HIDESEARCHBAR 1221
#define IDS_EXP_TITLEBAR 1222
#define IDS_EXP_TITLEBAR_0 1223
#define IDS_EXP_TITLEBAR_1 1224
#define IDS_EXP_TITLEBAR_2 1225
#define IDS_EXP_TITLEBAR_3 1226
#define IDS_EXP_MICA 1227

#define IDS_START 1301
#define IDS_START_STYLE 1302
Expand Down
5 changes: 1 addition & 4 deletions ep_gui/resources/lang/ep_gui.en-US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ BEGIN
IDS_EXP_TITLEBAR_1 "Hide title, show icon"
IDS_EXP_TITLEBAR_2 "Hide icon, show title"
IDS_EXP_TITLEBAR_3 "Hide icon and title"
IDS_EXP_MICA "Apply Mica effect on these areas"
IDS_EXP_MICA_0 "Let File Explorer decide (default)"
IDS_EXP_MICA_1 "Title bar, command bar and navigation bar"
IDS_EXP_MICA_2 "Nowhere"
IDS_EXP_MICA "Apply Mica effect to the navigation bar of Windows 7 Explorer windows"

IDS_START "Start menu"

Expand Down
35 changes: 16 additions & 19 deletions ep_gui/resources/settings.reg
Original file line number Diff line number Diff line change
Expand Up @@ -207,41 +207,38 @@
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 4 %R:1209% *
;x 0 %R:1210%
;x 4 %R:1230%
;x 1 %R:1212%
;x 2 %R:1213%
;x 4 %R:1212%
;x 1 %R:1214%
;x 2 %R:1215%
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_FileExplorerCommandUI"=dword:00000000
;t %R:1214%
;t %R:1216%
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;i %R:1215% **
;i %R:1217% **
"DisableImmersiveContextMenu"=dword:00000000
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{056440FD-8568-48e7-A632-72157243B55B}\InprocServer32]
;d %R:1216% **
;d %R:1218% **
@=""
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b %R:1217%
;b %R:1219%
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_DisableModernSearchBar"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b %R:1218% **
;b %R:1220% **
"ShrinkExplorerAddressBar"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b %R:1219% **
;b %R:1221% **
"HideExplorerSearchBar"=dword:00000000
;s Explorer_TitlebarSection !IsWindows11Version22H2OrHigher
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 4 %R:1220%
;x 0 %R:1221%
;x 1 %R:1222%
;x 2 %R:1223%
;x 3 %R:1224%
;c 4 %R:1222%
;x 0 %R:1223%
;x 1 %R:1224%
;x 2 %R:1225%
;x 3 %R:1226%
"HideIconAndTitleInExplorer"=dword:00000000
;g Explorer_TitlebarSection
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 3 %R:1225%
;x 0 %R:1226%
;x 1 %R:1227%
;x 2 %R:1228%
;b %R:1227% **
"MicaEffectOnTitlebar"=dword:00000000
;g Explorer_TitlebarSection



Expand Down
16 changes: 8 additions & 8 deletions ep_gui/resources/settings10.reg
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,24 @@
"UseClassicDriveGrouping"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 2 %R:1209%
;x 0 %R:1211%
;x 2 %R:1213%
;x 0 %R:1213%
;x 2 %R:1215%
"FileExplorerCommandUI"=dword:00000000
;t %R:1214%
;t %R:1216%
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;i %R:1215% **
;i %R:1217% **
"DisableImmersiveContextMenu"=dword:00000000
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{056440FD-8568-48e7-A632-72157243B55B}\InprocServer32]
;d %R:1216% **
;d %R:1218% **
@=""
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b %R:1217%
;b %R:1219%
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_DisableModernSearchBar"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b %R:1218% **
;b %R:1220% **
"ShrinkExplorerAddressBar"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b %R:1219% **
;b %R:1221% **
"HideExplorerSearchBar"=dword:00000000
;p 2
;b Mica effect on title bar
Expand Down

0 comments on commit f62c532

Please sign in to comment.