Skip to content

Commit

Permalink
File Explorer: Added option to disable the modern navigation bar (FEM…
Browse files Browse the repository at this point in the history
…NB).

- The code for disabling tabs (TIFE) is also there, but it doesn't work on 22621.2506+ -- it fallbacks to the Windows 10 Ribbon instead so I'm hiding it for now.
- This should also fix window position saving when using Windows 10 Ribbon on builds with TIFE enabled, up to 23570 (Dev).
  • Loading branch information
Amrsatrio committed Nov 12, 2023
1 parent b45f79f commit 2dc1340
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
1 change: 1 addition & 0 deletions ExplorerPatcher-L10N
Submodule ExplorerPatcher-L10N added at 4a7eaa
38 changes: 33 additions & 5 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -3877,7 +3877,7 @@ HWND WINAPI explorerframe_SHCreateWorkerWindowHook(
KEY_READ | KEY_WOW64_64KEY,
NULL,
(LPDWORD)(&dwSize)
) == ERROR_SUCCESS && (dwSize < 4) && dwExStyle == 0x10000 && dwStyle == 1174405120)
) == ERROR_SUCCESS && (dwSize < 4) && dwExStyle == 0x10000 && dwStyle == 0x46000000)
{
result = 0;
}
Expand Down Expand Up @@ -3906,6 +3906,13 @@ HWND WINAPI explorerframe_SHCreateWorkerWindowHook(
{
SetWindowSubclass(hWndParent, HideExplorerSearchBarSubClass, HideExplorerSearchBarSubClass, 0);
}
if (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));
}
}
return result;
}
Expand Down Expand Up @@ -8606,7 +8613,7 @@ DEFINE_GUID(IID_UIRibbonFramework,

HRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv)
{
if (dwFileExplorerCommandUI != 0 && IsEqualCLSID(rclsid, &CLSID_XamlIslandViewAdapter))
if (dwFileExplorerCommandUI != 0 && dwFileExplorerCommandUI != 3 && dwFileExplorerCommandUI != 4 && IsEqualCLSID(rclsid, &CLSID_XamlIslandViewAdapter))
{
return REGDB_E_CLASSNOTREG;
}
Expand Down Expand Up @@ -9653,10 +9660,22 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c
break;
}
#endif
#if 1
case 37634385: // TIFE "Tabs in File Explorer"
{
if (dwFileExplorerCommandUI == 1 // Windows 10 Ribbon <-- fixes saving of window position and size
|| dwFileExplorerCommandUI == 2 // Windows 7 Command Bar <-- fixes menu bar behavior
|| dwFileExplorerCommandUI == 3) // Windows 11 Command Bar (no Tabs, classic Address Bar) <-- provides option to disable tabs in File Explorer
{
// Removed in 23575.1000+
buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;
}
break;
}
case 40729001: // WASDKInFileExplorer
{
if (dwFileExplorerCommandUI != 0)
if (dwFileExplorerCommandUI == 1 // Windows 10 Ribbon <-- fixes crashing when navigating back to a WASDK view
|| dwFileExplorerCommandUI == 2 // Windows 7 Command Bar <-- ditto
|| dwFileExplorerCommandUI == 3) // Windows 11 Command Bar (no Tabs, classic Address Bar) <-- fixes crashing when opening an Explorer window
{
// Disable the new Windows App SDK views (in Home and Gallery) when not using the Windows 11 command bar
//
Expand All @@ -9673,7 +9692,16 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c
}
break;
}
#endif
case 40950262: // FEMNB "File Explorer Modern Navigation Bar"
{
if (dwFileExplorerCommandUI == 3 // Windows 11 Command Bar (no Tabs, classic Address Bar)
|| dwFileExplorerCommandUI == 4) // Windows 11 Command Bar (classic Address Bar)
{
// Option to disable the new navigation bar
buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;
}
break;
}
#if 0
case 42952021: // CategorySpecificXamlExtensions
{
Expand Down
2 changes: 2 additions & 0 deletions ep_gui/resources/EPSettingsResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
#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_START 1301
#define IDS_START_STYLE 1302
Expand Down
2 changes: 2 additions & 0 deletions ep_gui/resources/lang/ep_gui.en-US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ BEGIN
IDS_EXP_CTRLINTF_0_W10 "Windows 10 Ribbon (default)"
IDS_EXP_CTRLINTF_1_W11 "Windows 10 Ribbon"
IDS_EXP_CTRLINTF_2 "Windows 7 Command Bar"
IDS_EXP_CTRLINTF_3 "Windows 11 Command Bar (no Tabs, classic Address Bar)"
IDS_EXP_CTRLINTF_4 "Windows 11 Command Bar (classic Address Bar)"
IDS_EXP_NEWWINDOWS "The following settings take effect on newly created File Explorer windows:"
IDS_EXP_IMMERSIVEMENUS "Use immersive menus when displaying Windows 10 context menus"
IDS_EXP_DISABLENAVBAR "Disable navigation bar"
Expand Down
3 changes: 2 additions & 1 deletion ep_gui/resources/settings.reg
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@
;b %R:1208%
"UseClassicDriveGrouping"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 3 %R:1209% *
;c 4 %R:1209% *
;x 0 %R:1210%
;x 4 %R:1230%
;x 1 %R:1212%
;x 2 %R:1213%
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_FileExplorerCommandUI"=dword:00000000
Expand Down

0 comments on commit 2dc1340

Please sign in to comment.