File Explorer List view indent fix and files area spacing
Removes the empty space before every item in the List, Small icons and Content views of File Explorer, and evens out the gaps around the items, icons and names of the files area
Author: NDruce
Starting with Windows 11 version 22H2, File Explorer reserves a 28 pixels wide
area to the left of every item in the List, Small icons and
Content views.
The area is meant for sync status icons of cloud folders (OneDrive and other
sync providers), but it's reserved in every folder, including the folders
which have nothing to do with the cloud. The result is an odd indent between
the edge of an item and its icon.
The mod removes that area where there's nothing to show. It also fixes a
number of smaller spacing inconsistencies in the files area. Every adjustment
has a setting, and can be changed or turned off.
The mod only deals with the files area: the part of a folder window which
shows the files and the folders. It doesn't touch the navigation pane, the
command bar or the address bar.
Before and after
All the files are selected in the screenshots, to show the gaps around the
items. The top half of each image is without the mod, the bottom half is with
the mod and its default settings.
List

Small icons

Content

Details

Tiles

What it does
- No empty status area. The reserved area is removed where there's nothing
to show. Items which have a status icon, and all the items inside of a cloud
folder, still have it, so the status icons keep working and stay aligned.
Optionally, the status icons can be hidden in the List and Small icons views
altogether.
- Even gaps around an item. The gap between the border of an item and its
content is the same on the left and on the right, in the List, Small icons,
Tiles, Content and Details views. The size of the gap is configurable. The
right gap of the List view has a correction of its own.
- Narrower status icon area. The same gap is used on both sides of a
status icon, also in the Tiles and Content views.
- Icon and name. A configurable gap is added between the item icon and the
name, the same in the List, Small icons and Details views. The names and the
status icons can be moved vertically. The Small icons view has a separate
offset for the names.
- Rows of the Details view. The gap between the icon and the name is made
the same as in the List view. A negative offset of the names is taken from
the height of the rows, so that the names stay centered in the rows.
- Rows of the Content view. The padding below the text of a row is
configurable.
- Even margins around the files area. The files area gets margins on all
four sides, in all views. The horizontal and the vertical margins are
configurable separately.
Defaults
Only the removal of the empty status area is a fix in the strict sense. The
other adjustments are a matter of taste, and they're turned on by default too.
To get the stock look of a part back, use these values:
- Even item spacing: off. That also turns off the gaps and the offsets of the
icons and the names, and the adjustments of the Details and Content rows.
- Horizontal and vertical margins of the files area: 0.
Scaling
The gaps, the paddings and the margins follow the display scaling. The
vertical offsets and the correction of the right gap are small corrections of
a pixel or two, and are applied in physical pixels regardless of the scaling.
Items which are already displayed when the display scaling changes keep the
old spacing until the folder is reopened or refreshed. With fractional scaling
such as 125%, the gaps can differ by a pixel because of rounding.
The mod works with the compact view of File Explorer turned on or off, and
with the item check boxes.
Other programs
By default, the mod only applies to File Explorer (explorer.exe). That's the
recommended setup, and nothing has to be configured for it.
The same items view is used by the Open/Save dialogs of other programs. To fix
it there too, add the programs to the custom process inclusion list in the
Advanced tab of the mod, by the name of the executable file, for example
notepad.exe. explorer.exe doesn't have to be added, it's always included.
It's also possible to add *, which means all programs. The mod is then
loaded into every process, including the ones which never show a file dialog,
so adding only the programs you need is the lighter option.
Only 64-bit programs are supported. In a program other than File Explorer, the
mod does nothing until the program loads the items view (explorerframe.dll),
which usually happens when a file dialog is opened for the first time.
How it works
The indent comes from UIProperty::HasVisibleContent in explorerframe.dll,
which reports the status icons area as having content in the List, Small icons
and Content views regardless of the actual content. The mod makes it report the
actual state. That relies on the debug symbols of explorerframe.dll, which
Windhawk downloads from Microsoft. Right after a Windows update, the symbols of
the new build might not be published yet. Until they are, the status area is
left as is, and the rest of the adjustments still work. To try to load the
symbols again, change a setting of the mod, or turn the mod off and on again.
Windhawk waits for a minute after a failed attempt before it tries again, and
for a few hours when File Explorer is restarted. A restart of Windhawk or of
the computer always makes it try again.
Everything else is done by changing properties of DirectUI elements: of the
items and of the items area. The elements are adjusted when they're created,
and the windows which are already open are adjusted when the mod is loaded.
The functions which are exported by dui70.dll are used for that.
No files are modified. The adjustments are only made to elements which have
the expected stock values, so that the mod stays out of the way of other
customizations. When the mod is turned off, the stock values are restored.
The code of the status area fix was verified to have the expected shape in
Windows 11 builds 22621.317 - 22621.6274 (22H2, 23H2), 26100.1 - 26100.9974
(24H2, 25H2), 28000.1761 - 28000.3086 (26H1) and 26300 (26H2 preview). The
adjustments of the Details view rows were tested on build 26300 at 125%
scaling.