# ql-win/quicklook architecture

> Architecture diagram of the GitHub repository ql-win/quicklook, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ql-win/quicklook
- Repository: https://github.com/ql-win/quicklook

## Overview

#### Purpose and entry points
QuickLook is a Windows desktop utility that opens an instant preview for the selected file, principally through Space and keyboard navigation. The primary executable is a WPF application initialized by `QuickLook/App.xaml` and `QuickLook/App.xaml.cs`; its project is `QuickLook/QuickLook.csproj`. The preview surface is `QuickLook/ViewerWindow.xaml` with behavior split across `QuickLook/ViewerWindow.xaml.cs` and action/property partials.

#### Application orchestration
The resident application owns tray presence, input activation, preview-window lifetime, and interprocess coordination:
- `QuickLook/TrayIconManager.cs` and `QuickLook/TrayIconWindow.cs` expose the background/tray control surface.
- `QuickLook/FocusMonitor.cs`, `QuickLook/KeystrokeDispatcher.cs`, and `QuickLook/Helpers/GlobalKeyboardHook.cs` detect selection/focus context and route keyboard commands.
- `QuickLook/ViewWindowManager.cs` creates, reuses, closes, and navigates viewer windows.
- `QuickLook/PipeServerManager.cs` is a process boundary for commands forwarded to the running instance.

Control flow is selection/context → key or forwarded command → view-window manager → plugin selection/rendering → viewer UI. The app also includes startup, update, shell, and sharing integration under `QuickLook/Helpers/AutoStartupHelper.cs`, `QuickLook/Helpers/Updater.cs`, and `QuickLook/Helpers/ShareHelper.cs`.

#### Plugin contract and loading boundary
The extensibility boundary is defined in the shared .NET library:
- `QuickLook.Common/Plugin/IViewer.cs`
- `QuickLook.Common/Plugin/ContextObject.cs`
- `QuickLook.Common/Plugin/MoreMenu/IMoreMenu.cs`

`QuickLook/PluginManager.cs` discovers and manages viewer implementations; `QuickLook.Common/Helpers/PluginHelper.cs` supports plugin operations. A viewer receives file/context information, determines support, and supplies a UI control and optional “More” menu actions. This isolates format-specific parsing/rendering from the host window and permits separately installed `.qlplugin` packages.

#### Built-in viewer families
The repository ships many viewer assemblies, each conventionally rooted at a `Plugin.cs` implementation and project file. Architecture-defining families include:
- General images and animations: `QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml`, `QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/AnimatedImage.cs`.
- Text/source inspection and syntax classification: `QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs`, `QuickLook.Plugin/QuickLook.Plugin.TextViewer/Detectors/FormatDetector.cs`.
- Archive/package metadata and file listing: `QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/ArchiveFileListView.xaml`, `QuickLook.Plugin/QuickLook.Plugin.AppViewer/Plugin.cs`.
- Document/media viewers: `QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs`.
- Binary/system-format inspection: `QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.ELFViewer/Plugin.cs`, `QuickLook.Plugin/QuickLook.Plugin.DumpViewer/Plugin.cs`.

#### Platform and rendering boundaries
The app is Windows-specific and combines managed WPF/XAML with Win32 and native C++. Managed interop is centralized in `QuickLook/NativeMethods/QuickLook.cs`, `QuickLook/NativeMethods/User32.cs`, and `QuickLook.Common/NativeMethods/Dwmapi.cs`; this supports shell/window behavior and Fluent-like visual integration. Several viewers embed web-rendered content or use browser assets, notably `QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs`, `QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/MarkdownPanel.cs`, and `QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Webview/WebHandler.cs`.

Native DLL projects provide hooks/integration for Explorer dialogs and third-party file managers across x86, x64, and ARM64: `QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj`, `QuickLook.Native/QuickLook.Native32/DialogHook.cpp`, and `QuickLook.Native/QuickLook.WoW64HookHelper/QuickLook.WoW64HookHelper.cpp`.

#### Distribution and deployment
The solution is `QuickLook.slnx`, comprising C# WPF projects and Visual C++ native projects. It supports three deployment forms: unpackaged installer via WiX (`QuickLook.Installer/Product.wxs`), MSIX/AppX via `QuickLook.Appx/QuickLook.Appx.wapproj` and `QuickLook.Appx/Package.appxmanifest`, and scripted release archives/installers under `Scripts/pack-all.ps1`, `Scripts/pack-appx.ps1`, and `Scripts/pack-setup.ps1`. GitHub Actions builds through `.github/workflows/msbuild.yml`.

Main entry points: [`QuickLook/PluginManager.cs`](https://github.com/ql-win/quicklook/blob/master/QuickLook/PluginManager.cs) (Plugin manager), [`QuickLook.Common/Plugin/IViewer.cs`](https://github.com/ql-win/quicklook/blob/master/QuickLook.Common/Plugin/IViewer.cs) (Viewer contracts), [`QuickLook/App.xaml`](https://github.com/ql-win/quicklook/blob/master/QuickLook/App.xaml) (WPF application), [`QuickLook.slnx`](https://github.com/ql-win/quicklook/blob/master/QuickLook.slnx) (Solution build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Desktop host"]
  node_app["WPF application<br/>entry point<br/>[App.xaml]"]
  node_tray["Tray control<br/>tray manager<br/>[TrayIconManager.cs]"]
  node_input["Selection &amp; key input<br/>input monitor<br/>[FocusMonitor.cs]"]
  node_pipe["Command pipe<br/>IPC server"]
  node_windows["Viewer window manager<br/>window lifecycle"]
  node_viewer["Preview surface<br/>WPF window<br/>[ViewerWindow.xaml]"]
end

subgraph group_plugin["Plugin system"]
  node_contracts["Viewer contracts<br/>shared .NET API<br/>[IViewer.cs]"]
  node_pluginmanager["Plugin manager<br/>plugin loader<br/>[PluginManager.cs]"]
  node_image["Image &amp; animation viewer<br/>built-in plugin<br/>[Plugin.cs]"]
  node_text["Text &amp; source viewer<br/>built-in plugin<br/>[Plugin.cs]"]
  node_archive["Archive &amp; app viewers<br/>built-in plugins<br/>[Plugin.cs]"]
  node_document["Document &amp; media viewers<br/>built-in plugins<br/>[Plugin.cs]"]
  node_binary["Binary format viewers<br/>built-in plugins<br/>[Plugin.cs]"]
  node_webcontent["Web-rendered viewers<br/>browser content<br/>[WebpagePanel.cs]"]
end

subgraph group_platform["Windows integration"]
  node_interop["Managed Win32 interop<br/>native bridge<br/>[QuickLook.cs]"]
  node_nativehooks["Explorer dialog hooks<br/>native DLLs<br/>[DialogHook.cpp]"]
end

subgraph group_delivery["Build &amp; delivery"]
  node_solution["Solution build<br/>[QuickLook.slnx]"]
  node_installer["Installer package<br/>WiX deployment<br/>[Product.wxs]"]
  node_appx["MSIX package<br/>AppX deployment"]
  node_release["Release packaging<br/>PowerShell pipeline<br/>[pack-all.ps1]"]
end

node_app -->|"owns"| node_tray
node_app -->|"starts"| node_input
node_app -->|"hosts"| node_pipe
node_input -->|"preview command"| node_windows
node_pipe -->|"forwarded command"| node_windows
node_windows -->|"selects viewer"| node_pluginmanager
node_windows -->|"manages"| node_viewer
node_pluginmanager -->|"uses API"| node_contracts
node_image -.->|"implements"| node_contracts
node_text -.->|"implements"| node_contracts
node_archive -.->|"implements"| node_contracts
node_document -.->|"implements"| node_contracts
node_binary -.->|"implements"| node_contracts
node_pluginmanager -->|"loads"| node_image
node_pluginmanager -->|"loads"| node_text
node_pluginmanager -->|"loads"| node_archive
node_pluginmanager -->|"loads"| node_document
node_pluginmanager -->|"loads"| node_binary
node_document -->|"renders through"| node_webcontent
node_viewer -->|"window and shell calls"| node_interop
node_nativehooks -->|"native integration"| node_app
node_solution -->|"builds"| node_app
node_solution -->|"builds"| node_nativehooks
node_solution -->|"packages"| node_installer
node_solution -->|"packages"| node_appx
node_release -->|"assembles"| node_installer
node_release -->|"assembles"| node_appx

click node_app "https://github.com/ql-win/quicklook/blob/master/QuickLook/App.xaml"
click node_tray "https://github.com/ql-win/quicklook/blob/master/QuickLook/TrayIconManager.cs"
click node_input "https://github.com/ql-win/quicklook/blob/master/QuickLook/FocusMonitor.cs"
click node_pipe "https://github.com/ql-win/quicklook/blob/master/QuickLook/PipeServerManager.cs"
click node_windows "https://github.com/ql-win/quicklook/blob/master/QuickLook/ViewWindowManager.cs"
click node_viewer "https://github.com/ql-win/quicklook/blob/master/QuickLook/ViewerWindow.xaml"
click node_contracts "https://github.com/ql-win/quicklook/blob/master/QuickLook.Common/Plugin/IViewer.cs"
click node_pluginmanager "https://github.com/ql-win/quicklook/blob/master/QuickLook/PluginManager.cs"
click node_image "https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs"
click node_text "https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs"
click node_archive "https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs"
click node_document "https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs"
click node_binary "https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs"
click node_webcontent "https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs"
click node_interop "https://github.com/ql-win/quicklook/blob/master/QuickLook/NativeMethods/QuickLook.cs"
click node_nativehooks "https://github.com/ql-win/quicklook/blob/master/QuickLook.Native/QuickLook.Native32/DialogHook.cpp"
click node_solution "https://github.com/ql-win/quicklook/blob/master/QuickLook.slnx"
click node_installer "https://github.com/ql-win/quicklook/blob/master/QuickLook.Installer/Product.wxs"
click node_appx "https://github.com/ql-win/quicklook/blob/master/QuickLook.Appx/QuickLook.Appx.wapproj"
click node_release "https://github.com/ql-win/quicklook/blob/master/Scripts/pack-all.ps1"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_tray,node_input,node_pipe,node_windows,node_viewer toneBlue
class node_contracts,node_pluginmanager,node_image,node_text,node_archive,node_document,node_binary,node_webcontent toneAmber
class node_interop,node_nativehooks toneMint
class node_solution,node_installer,node_appx,node_release toneRose
```

## Components

### Desktop host

Resident WPF application and preview lifecycle.

- [WPF application](https://github.com/ql-win/quicklook/blob/master/QuickLook/App.xaml): entry point · Initializes the resident QuickLook process. · `QuickLook/App.xaml`
- [Tray control](https://github.com/ql-win/quicklook/blob/master/QuickLook/TrayIconManager.cs): tray manager · Provides the background control surface. · `QuickLook/TrayIconManager.cs`
- [Selection & key input](https://github.com/ql-win/quicklook/blob/master/QuickLook/FocusMonitor.cs): input monitor · Detects context and dispatches preview commands. · `QuickLook/FocusMonitor.cs`
- [Command pipe](https://github.com/ql-win/quicklook/blob/master/QuickLook/PipeServerManager.cs): IPC server · Forwards commands to the running instance. · `QuickLook/PipeServerManager.cs`
- [Viewer window manager](https://github.com/ql-win/quicklook/blob/master/QuickLook/ViewWindowManager.cs): window lifecycle · Creates, reuses, closes, and navigates preview windows. · `QuickLook/ViewWindowManager.cs`
- [Preview surface](https://github.com/ql-win/quicklook/blob/master/QuickLook/ViewerWindow.xaml): WPF window · Hosts selected viewer controls and actions. · `QuickLook/ViewerWindow.xaml`

### Plugin system

Shared contracts, loading, and built-in viewers.

- [Viewer contracts](https://github.com/ql-win/quicklook/blob/master/QuickLook.Common/Plugin/IViewer.cs): shared .NET API · Defines viewer context and optional More-menu extensions. · `QuickLook.Common/Plugin/IViewer.cs`
- [Plugin manager](https://github.com/ql-win/quicklook/blob/master/QuickLook/PluginManager.cs): plugin loader · Discovers and selects installed viewer implementations. · `QuickLook/PluginManager.cs`
- [Image & animation viewer](https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs): built-in plugin · `QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs`
- [Text & source viewer](https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs): built-in plugin · Classifies formats for source inspection. · `QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs`
- [Archive & app viewers](https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs): built-in plugins · Lists package and archive contents. · `QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs`
- [Document & media viewers](https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs): built-in plugins · Includes PDF, video, and Markdown previews. · `QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs`
- [Binary format viewers](https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs): built-in plugins · Inspects PE, ELF, and dump files. · `QuickLook.Plugin/QuickLook.Plugin.PEViewer/Plugin.cs`
- [Web-rendered viewers](https://github.com/ql-win/quicklook/blob/master/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs): browser content · Renders HTML, Markdown, and image web content. · `QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/WebpagePanel.cs`

### Windows integration

Managed interop and native Explorer hooks.

- [Managed Win32 interop](https://github.com/ql-win/quicklook/blob/master/QuickLook/NativeMethods/QuickLook.cs): native bridge · Supports shell, window, and visual integration. · `QuickLook/NativeMethods/QuickLook.cs`
- [Explorer dialog hooks](https://github.com/ql-win/quicklook/blob/master/QuickLook.Native/QuickLook.Native32/DialogHook.cpp): native DLLs · Integrates Explorer dialogs and third-party file managers across architectures. · `QuickLook.Native/QuickLook.Native32/DialogHook.cpp`

### Build & delivery

Solution build and deployment outputs.

- [Solution build](https://github.com/ql-win/quicklook/blob/master/QuickLook.slnx): solution · Builds C# WPF and Visual C++ projects. · `QuickLook.slnx`
- [Installer package](https://github.com/ql-win/quicklook/blob/master/QuickLook.Installer/Product.wxs): WiX deployment · Produces the unpackaged installer. · `QuickLook.Installer/Product.wxs`
- [MSIX package](https://github.com/ql-win/quicklook/blob/master/QuickLook.Appx/QuickLook.Appx.wapproj): AppX deployment · Produces the packaged Windows deployment. · `QuickLook.Appx/QuickLook.Appx.wapproj`
- [Release packaging](https://github.com/ql-win/quicklook/blob/master/Scripts/pack-all.ps1): PowerShell pipeline · Builds release archives and installers. · `Scripts/pack-all.ps1`

## Connections

- WPF application → Tray control: owns
- WPF application → Selection & key input: starts
- WPF application → Command pipe: hosts
- Selection & key input → Viewer window manager: preview command
- Command pipe → Viewer window manager: forwarded command
- Viewer window manager → Plugin manager: selects viewer
- Viewer window manager → Preview surface: manages
- Plugin manager → Viewer contracts: uses API
- Image & animation viewer → Viewer contracts: implements
- Text & source viewer → Viewer contracts: implements
- Archive & app viewers → Viewer contracts: implements
- Document & media viewers → Viewer contracts: implements
- Binary format viewers → Viewer contracts: implements
- Plugin manager → Image & animation viewer: loads
- Plugin manager → Text & source viewer: loads
- Plugin manager → Archive & app viewers: loads
- Plugin manager → Document & media viewers: loads
- Plugin manager → Binary format viewers: loads
- Document & media viewers → Web-rendered viewers: renders through
- Preview surface → Managed Win32 interop: window and shell calls
- Explorer dialog hooks → WPF application: native integration
- Solution build → WPF application: builds
- Solution build → Explorer dialog hooks: builds
- Solution build → Installer package: packages
- Solution build → MSIX package: packages
- Release packaging → Installer package: assembles
- Release packaging → MSIX package: assembles
