Add Click on Empty Explorer mod - #4500
Conversation
|
Thanks for the submission. Instead of having many variations based on the Explorer Double Click Up mod (another example: #4048), it'd be preferable to have a single mod that allows to customize the middle click and double click actions, similar to the way Click on empty taskbar space does it for the taskbar. Will you be willing to enhance the mod and maintain it? |
Thanks for the feedback! I've replaced the single-purpose mod with a unified one — click-on-empty-explorer. It now supports three trigger types (double left click, single middle click, double middle click) and each can be set to any of 11 actions: Go Up, Go Back, Go Forward, Go to Desktop, Go to Home, Refresh, New Tab, Duplicate Tab, Close Tab, New Folder, Copy Path. |
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.
ExplorerWrapper* wrapper = FindWrapper(parent); // pointer into g_Wrappers
if (wrapper) {
wrapper->DoAction(action); // another thread may have reallocated by nowThis is inherited from the base mod (which has the same latent race), so it's low-probability in practice, but the new
Optional improvements
Minor polish — none of this affects users in normal operation, so it's your call.
Functionality notes
Non-critical observations about the feature behavior itself.
|
All issues addressed:
|
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.
Related: "Global COM objects with non-trivial destructors run at process shutdown." from the previous review isn't fixed. I think the simplest solution here is the following:
Deadlock on unload — {
std::lock_guard<std::mutex> lk(g_wrappersMutex); // line 846
for (ExplorerWrapper& wrapper : g_Wrappers) {
...
WindhawkUtils::RemoveWindowSubclassFromAnyThread(hWnd, SysListViewSubclass); // 853
...
WindhawkUtils::RemoveWindowSubclassFromAnyThread(hWnd, DUISubclass); // 855
}
g_Wrappers.clear();
}
Fix is the standard copy-then-release-then-call pattern — collect the handles under the lock, drop it, then remove the subclasses: std::vector<std::pair<HWND, bool>> toRemove; // {hwnd, isSysListView}
{
std::lock_guard<std::mutex> lk(g_wrappersMutex);
for (ExplorerWrapper& w : g_Wrappers) {
HWND hWnd = w.hListView;
if (hWnd && IsWindow(hWnd)) {
wchar_t cn[256];
if (GetClassName(hWnd, cn, 256))
toRemove.push_back({hWnd, wcscmp(cn, L"SysListView32") == 0});
}
}
g_Wrappers.clear();
}
for (auto& [hWnd, isLV] : toRemove)
WindhawkUtils::RemoveWindowSubclassFromAnyThread(
hWnd, isLV ? SysListViewSubclass : DUISubclass);(The reference mod gets away with calling Optional improvements
Minor polish — none of this affects users in the common case, so it's your call.
Functionality notes
Non-critical observations about the feature behavior itself.
|
|
All three fixes pushed. Deadlock resolved — collect HWNDs under lock, unlock subclasses without holding the mutex. Settings snapshot deep-copied with std::wstring. COM cleanup removed. wcsncpy fixed with explicit terminator and triple-click reset. Nothing more to address from this round. |
|
|
|
The reason I asked to use Please use |
|
Wonderful mod! Please also consider adding "Paste" action for middle click, or a possibility of running any custom hotkey (so that I could assign it to Ctrl+V). |
Thanks a lot for your suggestion! I’ve updated the mod, now middle click paste and custom hotkey binding (including Ctrl+V assignment) are fully supported. |
|
@LiHua81 |
Summary
A unified mod that lets you configure what double left click, single middle click, and double middle click do when clicking on empty space in File Explorer.
Each trigger can be set to any of 11 actions: Go Up, Go Back, Go Forward, Go to Desktop, Go to Home, Refresh, New Tab, Duplicate Tab, Close Tab, New Folder, or Copy Path.
Double left click uses native Windows double-click detection (no delay). Double middle click uses a timer-based fallback (~500ms) since Windows doesn't support it natively — single middle click fires instantly when only single-click is configured, and is only delayed when both single and double middle click are enabled.
Tested on Windows 11 with both SysListView32 and DirectUIHWND views.
Test plan
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.