Skip to content

Transparent Desktop Icons with Spotlight#4283

Draft
drgutman wants to merge 10 commits into
ramensoftware:mainfrom
drgutman:main
Draft

Transparent Desktop Icons with Spotlight#4283
drgutman wants to merge 10 commits into
ramensoftware:mainfrom
drgutman:main

Conversation

@drgutman
Copy link
Copy Markdown
Contributor

@drgutman drgutman commented Jun 3, 2026

Make desktop icons transparent when idle with an interactive spotlight effect. Hover over the desktop or select icons to reveal them with customizable transitions.

Changelog

If this pull request updates an existing mod, describe the changes below:

🚀 Architecture Updates & Optimizations

  • Robust Thread-Safe Initialization: Fixed early-boot race conditions and cold-start bugs. Implemented a throttled desktop discovery loop with an exponential backoff system that safely triggers native overlay initialization on the correct desktop thread.
  • 0% CPU Deep Sleep: Replaced active rendering poll loops with an event-driven WaitForSingleObject wait. The background thread drops into an INFINITE sleep state (0.00% CPU/GPU) when the desktop is fully idle.
  • Zero-Latency Mouse Wake: Bypassed Windows timer throttling by intercepting hardware-level mouse events (WM_MOUSEFIRST/LAST and pointer updates) in the message dispatch hook to wake the render thread instantly.
  • Refactored Wallpaper Capture: Refined the background capture routine to target the correct WorkerW sibling and cleanly hide transient layers, resolving theme-change ghosting and recursive rendering bugs.
  • UX & Stability Fixes:
    • Keeps the spotlight fully illuminated while renaming desktop icons (F2 edit controls).
    • Added robust DXGI device loss recovery to rebuild the DirectX pipeline after GPU resets or system sleep.
    • Minor settings description changes for better readability

Mod authorship

If this pull request introduces a new mod, please complete the section below.

This mod was created by:

    • The submitter, without AI assistance
    • The submitter, with AI assistance
    • Claude
    • ChatGPT
    • Gemini
    • Another AI (please specify):
    • Other (please specify):

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.

drgutman added 10 commits June 1, 2026 15:54
Make desktop icons transparent when idle with an interactive spotlight effect. Hover over the desktop or select icons to reveal them with customizable transitions.
Updated description for Idle Opacity setting to clarify transparency levels.
Updated spotlight and selection fade durations in settings. Improved window handling and rendering logic.

Fixed a bunch of bugs, especially a nasty one that made the icons blink like crazy or disabled them after a system restart.
Optimised the RenderLoop thread so it doesn't run constantly, only when something is moving or fading. Removed a loop that used to manually set the alpha channel to 255 for every single pixel. (Changed D2D1_ALPHA_MODE_PREMULTIPLIED to D2D1_ALPHA_MODE_IGNORE in bitmapProps when calling CreateBitmap so D2D treats all pixels as fully opaque automatically.
Added fade-in/fade-out settings for both the spotlight and the selection.
Umm ... I don't know, quite a lot of stuff. 
Now it should really have a production-ready level of optimisation.
moved the WindowFromPoint(pt) check directly into the background render thread for extra snappiness. Now the spotlight should update instantly (within 1 to 7 milliseconds) when the mouse enters the desktop space.
Stability & Lifecycle Fixes:
Fixed Explorer crash on restart/exit: Switched g_renderThread to a heap pointer to prevent std::thread from calling std::terminate() during Windows DLL detachment.
Fixed use-after-free crash during bootstrap: Replaced the lambda callback in CreateWindowExW_Hook with a safe window timer (0x1337) caught in the message loop.
Fixed window class registration: Added UnregisterClass in Wh_ModUninit and replaced static booleans with GetClassInfo to prevent invisible overlays upon mod reload.
Performance & Code Quality:
True 0% GPU Idle: Fixed the stateChanged logic so the render thread completely sleeps when the spotlight is invisible, even if the mouse is moving in another application.
Removed unused bloat: Cleaned up @compilerOptions and #includes, removing unused libraries (like wininet, dwrite, pdh, etc.) and the dead g_hasSelection variable.
Safer Hooking: Migrated Wh_SetFunctionHook to the type-safe WindhawkUtils::SetFunctionHook.
Reliable Settings Updates: Wh_ModSettingsChanged now safely triggers LoadSettings() directly on the UI thread, preventing dropped updates if modified before the overlay window exists.
Bonus/Polish:
Eliminated Frame 1 Blindspot: Added an immediate PollDesktopState() call during initialisation so the render thread has the correct window handles on the very first frame.

Deferred Multi-monitor support for a later version, as it requires switching everything to virtual screen coordinates (SM_XVIRTUALSCREEN), which is a pretty massive structural change.

I refrained from implementing Live Wallpapers because it would require constant screen capture (effectively recording the screen 60 times a second), which would spike CPU/GPU usage heavily. Added a disclaimer in the README.
Updated feature description with a gif for preview and modified text for better clarity.
🚀 Architecture Updates & Optimizations
Robust Thread-Safe Initialisation: Fixed early-boot race conditions and cold-start bugs. Implemented a throttled desktop discovery loop with an exponential backoff system that safely triggers native overlay initialisation on the correct desktop thread.
0% CPU Deep Sleep: Replaced active rendering poll loops with an event-driven WaitForSingleObject wait. The background thread drops into an INFINITE sleep state (0.00% CPU/GPU) when the desktop is fully idle.
Zero-Latency Mouse Wake: Bypassed Windows timer throttling by intercepting hardware-level mouse events (WM_MOUSEFIRST/LAST and pointer updates) in the message dispatch hook to wake the render thread instantly.
Brand New Wallpaper Capture Methodology: Refined the background capture routine to target the correct WorkerW sibling and cleanly hide transient layers, resolving theme-change ghosting and recursive rendering bugs.
UX & Stability Fixes:
Keeps the spotlight fully illuminated while renaming desktop icons (F2 edit controls).
Added robust DXGI device loss recovery to rebuild the DirectX pipeline after GPU resets or system sleep.
Minor settings description changes for better readability
* Optimisations to the PollDesktopState function to reduce the CPU overhead of the polling loop and unnecessary system calls.
 - removed redundant SystemParametersInfoW wallpaper path check
 - local selected vector was converted into a static std::vector<RECT> s_selected that is cleared on each tick rather than reallocated on the heap
 - call LVM_GETSELECTEDCOUNT first, allowing the loop to completely bypass any list view queries if there are no selected icons on the desktop

* Removed a piece of dead code
@drgutman drgutman marked this pull request as draft June 4, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant