Skip to content

ChouDan6/QuickLook.Plugin.EnhancedPreview

Repository files navigation

QuickLook.Plugin.EnhancedPreview

A plugin for QuickLook that adds auto-reload on file change and per-file-type window positioning.

一款 QuickLook 插件,提供文件修改自动刷新按文件类型设置预览窗口位置两项功能。


Features / 功能

1. Auto Reload / 自动重载

Automatically refreshes the preview when the file is modified externally (e.g., edited by another application).
Uses both FileSystemWatcher and a 1-second polling timer for maximum reliability (including network drives).

当文件被外部程序修改时(如用其它编辑器保存了 .ini 文件),预览窗口会自动刷新内容。
同时使用 FileSystemWatcher 和每秒轮询机制,确保在网络驱动器等场景下也能可靠检测变化。

2. Window Position Rules / 窗口位置规则

Set where the preview window appears on screen based on file extension.
Default QuickLook behavior is always centered — this plugin lets you pin specific file types to corners or edges.

根据文件扩展名设置预览窗口在屏幕上的显示位置。
QuickLook 默认总是居中展开,本插件允许你将特定类型的文件预览固定到屏幕的角落或边缘。

Available positions / 可用位置:

Value 位置
TopLeft 左上角
TopCenter 顶部居中
TopRight 右上角
MiddleLeft 左侧居中
MiddleRight 右侧居中
BottomLeft 左下角
BottomCenter 底部居中
BottomRight 右下角

Installation / 安装

  1. Download the latest QuickLook.Plugin.EnhancedPreview.dll from Releases.
    Releases 下载最新的 QuickLook.Plugin.EnhancedPreview.dll

  2. Place it in a folder named QuickLook.Plugin.EnhancedPreview under QuickLook's plugin directory:
    将其放入 QuickLook 插件目录下的 QuickLook.Plugin.EnhancedPreview 文件夹中:

    %APPDATA%\pooi.moe\QuickLook\QuickLook.Plugin\QuickLook.Plugin.EnhancedPreview\
    └── QuickLook.Plugin.EnhancedPreview.dll
    
  3. Restart QuickLook.
    重启 QuickLook。


Usage / 使用方法

  1. Preview any file with QuickLook (select a file and press Space).
    用 QuickLook 预览任意文件(选中文件后按 空格键)。

  2. Click the More menu (?) in the title bar → "Enhanced Preview Settings...".
    点击标题栏的更多菜单 (?)"Enhanced Preview Settings..."

  3. Configure the two features (settings are saved automatically as you type):
    配置两项功能(输入内容时自动保存):

Auto Reload Extensions / 自动重载扩展名

Enter semicolon-separated file extensions:
输入以分号分隔的文件扩展名:

.ini;.txt;.log;.csv;.xml;.json

Position Rules / 位置规则

Format: extensions:Position
格式:扩展名:位置

.ini,.cfg:TopRight
.txt,.log:MiddleLeft
.png,.jpg:BottomRight

Multiple rules are separated by semicolons (;).
多条规则用分号 (;) 分隔。


Build / 编译

Requires the QuickLook source code (v4.5.0+).

  1. Place this project folder under QuickLook.Plugin\ in the QuickLook source tree.
  2. Add the project to the solution:
    dotnet sln QuickLook.sln add QuickLook.Plugin\QuickLook.Plugin.EnhancedPreview\QuickLook.Plugin.EnhancedPreview.csproj
    
  3. Build:
    dotnet build QuickLook.Plugin\QuickLook.Plugin.EnhancedPreview\QuickLook.Plugin.EnhancedPreview.csproj -c Release
    
  4. Output DLL is at Build\Release\QuickLook.Plugin\QuickLook.Plugin.EnhancedPreview\.

How It Works / 工作原理

This plugin implements IViewer (with CanHandle returning false) and IMoreMenuExtended.

  • IMoreMenuExtended: QuickLook calls MenuItems for every preview regardless of the matched plugin. This getter is used as the hook to activate both features.
  • Auto-reload: Detects file modification via FileSystemWatcher + polling File.GetLastWriteTimeUtc. On change, it retrieves the active plugin and ContextObject from the ViewerWindow via reflection, then calls Cleanup() + View() to refresh content in-place.
  • Window positioning: Reads the ViewerWindow instance from ViewWindowManager, then directly sets Window.Left / Window.Top based on screen working area and DPI scaling.

本插件实现了 IViewerCanHandle 始终返回 false)和 IMoreMenuExtended 接口。

  • IMoreMenuExtended:QuickLook 在每次预览时都会访问所有 IMoreMenuExtended 插件的 MenuItems,插件以此为入口激活功能。
  • 自动重载:通过 FileSystemWatcher + 轮询 File.GetLastWriteTimeUtc 检测文件变化。变化时通过反射获取当前活动插件和 ContextObject,直接调用 Cleanup() + View() 刷新内容。
  • 窗口定位:通过反射获取 ViewerWindow 实例,根据屏幕工作区和 DPI 缩放直接设置 Window.Left / Window.Top

License / 许可证

GPL-3.0 — same as QuickLook.

About

A plugin for QuickLook that adds auto-reload on file change and per-file-type window positioning.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages