Add explorer-tree-click-expand mod#4767
Conversation
Submission reviewNote: This review was done by Claude, and then refined manually. Due to the amount of submissions, doing a fully manual review for each pull request is no longer feasible. Thank you for understanding. Please address the following issues. The items in the collapsed sections are optional, so it's your call whether to address them. 1. The low-level hook has no message loop. The mod might work when loaded early (e.g. on boot) because the init runs on the main thread, and Explorer creates a message loop later on, but it's incorrect to rely on it. 2. Replace the system-wide mouse hook with subclassing the nav-pane tree. The mod only cares about clicks on Explorer's own navigation-pane 3. Cross-process corruption: 4. No blocking work inside a low-level hook. Optional improvements
Minor polish — none of this affects users once the items above are addressed, so it's your call.
|
|
Thanks for the detailed review! I've pushed a rewrite that addresses all four required items:
I also added proper cleanup in Haven't added the optional GIF yet, let me know if that's still worth doing before merge. Ready for another look whenever you have time. |
Sure, why not. Below is another review round. I didn't verify all the items manually. If you think it's OK as is, we can also submit the current version, let me know. Submission review1. The nav pane tree has multiple top-level (root) items in the default Windows 10/11 layout (Home/Quick access, Gallery, OneDrive, This PC, Network, …). It only has a single "Desktop" root when the "Show all folders" folder option is enabled — which is exactly the configuration the code's comment ("e.g. 'Desktop'") assumes. void CollapseAllKeepingRoot(HWND hwndTree) {
HTREEITEM hRoot = TreeView_GetRoot(hwndTree); // only the FIRST root
if (!hRoot) {
return;
}
TreeView_Expand(hwndTree, hRoot, TVE_EXPAND);
CollapseAllRecursive(hwndTree, TreeView_GetChild(hwndTree, hRoot));
}
void CollapseAllKeepingRoot(HWND hwndTree) {
for (HTREEITEM hRoot = TreeView_GetRoot(hwndTree); hRoot;
hRoot = TreeView_GetNextSibling(hwndTree, hRoot)) {
// Keep each top-level root expanded, collapse everything below it.
CollapseAllRecursive(hwndTree, TreeView_GetChild(hwndTree, hRoot));
}
}For reference, other nav-pane mods explicitly account for both layouts — e.g. never-auto-expand-explorer-tree-items.wh.cpp#L120-L138 (single-root vs. top-level, where a top-level item's parent is 2. Add a screenshot/GIF to the README. This mod has a visible, interactive effect (click → folder expands), which is hard to convey in prose. A short GIF of a left-click expanding one level and Alt+click expanding all would make the catalog entry much clearer. Allowed image hosts are Optional improvements
Minor polish — none of this affects users, so it's your call.
Functionality notes
Non-critical observations about the feature behavior itself.
|
|
Thanks for the review! I've pushed a new commit addressing everything: Fixed CollapseAllKeepingRoot — it was only collapsing the subtree under the first root item (TreeView_GetRoot only returns the first one), so on the default nav pane layout (multiple sibling roots: Home, This PC, Network, etc.) Ctrl+click did nothing outside the first root. Now it iterates all top-level sibling roots with TreeView_GetNextSibling and collapses everything under each one, while keeping the roots themselves visible. |
By default, in File Explorer's navigation pane (tree view), left-clicking
a folder only selects it; you have to click the small chevron/arrow to
expand it.
This mod adds three click behaviors to the navigation pane tree:
pressing Numpad +). The native chevron behavior is untouched.
its original state (all folders collapsed).
recursively, down to the last level (like pressing the Numpad * key).
Both Ctrl+click and Alt+click behaviors can be individually enabled or
disabled in the mod's settings. Both are enabled by default.
Changelog
If this pull request updates an existing mod, describe the changes below:
Mod authorship
If this pull request introduces a new mod, please complete the section below.
This mod was created by:
Please select the options that best apply. Your selection does not affect the acceptance criteria, but it helps reviewers understand the context of the code and provide relevant feedback.