DEV Community

yyzTools
yyzTools

Posted on

Space-Bar File Preview Everywhere: Borrowing macOS Quick Look's Best Trick for Windows

I build yyzTools — a free, local-first Windows toolkit that folds 40+ tools into one installer. The 1.0.9 release added system-level space-bar file preview, and the interesting parts are the trigger chain (borrowed with credit from QuickLook), the "one preview control, four entry points" rule, and what falls through to a hex viewer.

file preview


macOS users have had this since 2009: select a file, hit space, see it. Hit space again, it's gone. No app launches, no focus stolen, no ceremony. Windows never shipped an answer, and the third-party attempts all stop one step short — they preview in Explorer, but the moment you find the file somewhere else (a search tool, a disk analyzer), you're back to double-clicking.

yyzTools 1.0.9 (Sep 20) ships space-bar preview, and the design rule that shaped it was: preview has to work at every point where you meet a file, or it doesn't really work anywhere. This post is about the three engineering decisions that made that rule affordable.

1. The trigger: listen, don't intercept

The obvious implementation is a global keyboard hook (SetWindowsHookEx) that grabs VK_SPACE when Explorer has focus. The obvious implementation is also the one that breaks scrolling: Explorer already uses space (scroll down in details view), and a hook that swallows the key to open a preview has now degraded every file manager it touches.

What shipped instead is a read-only listener on RawInput:

  • RawInput, not a hook. The preview manager registers for raw keyboard input in its own process. It sees the space press; it never consumes it. Explorer's native space behavior keeps working.
  • The trigger chain idea is borrowed from QuickLook (the open-source Windows one — QL-Win/QuickLook, GPL). Credit where due: their space-up/space-down handling and auto-repeat suppression is documented in their source, and I followed the same approach rather than rediscovering it.
  • A one-second suppression after typing. If the focused window recently received character input (you just renamed a file, you're in the search box), space is a spacebar, not a preview toggle. The listener waits for the input context to go quiet.
  • Focus and selection tracking. A 500 ms poll follows the current selection in the active file manager; when focus leaves file-management surfaces, the preview hides itself.

On by default, off in Settings. A feature that types in file managers has to be removable in one click, or it's malware-adjacent.

2. Getting the selected file: one interface, seven file managers

"Which file is selected" sounds trivial until you leave Explorer. The selection probe (ExplorerSelection) speaks several dialects:

  • Explorer & desktop — Shell COM (IShellWindows / IFolderView2), the honest way.
  • Directory Opus — their official dopusrt IPC, because DOpus is its own universe and they document the door.
  • Everything, Multi Commander, IDM, FilePilot, DeskBox — each with its own probe.

Same interface behind all of them: GetSelectedPath() or nothing. The preview doesn't care which app is in front; it cares whether something answered.

3. One preview control, four entry points

This is the part I'd defend hardest. The preview window is a single WinFilePreview surface with one non-negotiable behavior: it never steals focus. It shows with SW_SHOWNOACTIVATE, which is what lets the arrow keys in the file manager keep moving the selection while the preview follows along — select file, space, arrow, arrow, each one re-rendering. That follow-along loop is the entire value of Quick Look, and it dies the moment the preview takes keyboard focus.

Inside, rendering is a WebView2 host with one front-end module per file type:

  • Images (jpg/png/gif/webp/svg...), zoom and rotate
  • ~57 text/code extensions with CodeMirror syntax highlighting
  • Markdown, PDF (paginated)
  • Office: docx/xlsx/pptx first page — no Office install needed
  • Video (mp4/webm/mov/mkv) and audio (mp3/wav/ogg) play inline
  • 3D models (gltf/glb/fbx/obj/stl/ply/dae) — interactive, you can rotate them
  • CAD drawings (DXF) — parsed and rendered client-side
  • Anything unrecognized falls through to a binary hex view, not a blank window

The 3D/CAD line matters more than it looks: most Windows previewers don't have it, and for anyone working with game assets or mechanical drawings, "space to spin the model" is the whole feature.

And the entry points: Explorer (and the third-party managers above), the built-in Lightning File Search, the Lightning Disk Space Analyzer, and the command palette's file module. Same key, same window, same behavior. The search → preview → Enter-to-open loop is where it pays off daily: you stopped opening files to check if they're the right files.

What it doesn't do

Honest limits, so nobody's surprised: archives don't list their contents (they fall to the hex view), PSD/RAW aren't rendered, odd encodings can garble, and huge videos take a second or two before the first frame. AVI/WMV/FLV depend on what WebView2's codec set will decode.


yyzTools is free, no account, no telemetry — the only network calls in the suite are features that inherently need one (translation, update checks). Windows 10/11, 12 languages, 387 command modules, yyztools.com. Questions about the RawInput chain, the DOpus IPC, or the focus-preserving window are welcome in the comments.

Top comments (0)