Skip to content

Instantly share code, notes, and snippets.

@scorphus
Created June 25, 2026 08:58
Show Gist options
  • Select an option

  • Save scorphus/ee6a7a68617ac48d5ad6c1e6c7a833ed to your computer and use it in GitHub Desktop.

Select an option

Save scorphus/ee6a7a68617ac48d5ad6c1e6c7a833ed to your computer and use it in GitHub Desktop.
Customizing Glance Quick Look font on macOS (and re-signing the extension so it still loads)

Customizing Glance Quick Look font (and re-signing so it still loads)

Glance is an all-in-one macOS Quick Look plugin (source code, markdown, JSON, archives, Jupyter, etc.) with dark-mode support. It has no settings UI — the fonts/sizes are hardcoded in CSS inside the app bundle. You can edit them, but on Apple Silicon any edit invalidates the extension's code signature, so it must be re-signed correctly or macOS will silently stop loading the Quick Look extension.

Where the styles live

/Applications/Glance.app/Contents/PlugIns/QLPlugin.appex/Contents/Resources/
  shared-main.css     # base body font-size + font-family vars + code/pre rule
  shared-chroma.css   # syntax-highlight (chroma) token colors
  markdown-main.css   # markdown-specific rules

Key rules in shared-main.css:

:root {
  --font-family-monospace: "Menlo", monospace;          /* code font face   */
  --font-family-sans-serif: -apple-system, ...;         /* body font face   */
}
body { font-size: 14px; ... }                            /* base text size   */
code, pre { font-size: 0.9em; font-family: var(--font-family-monospace); }
  • Body text size → the body { font-size } rule.
  • Code preview size → the code, pre { font-size } rule (relative em tracks the body size; use an explicit px to pin it).

The re-sign recipe that keeps it loadable

The critical detail: the original Glance signature is itself ad-hoc with app-sandbox entitlements and the runtime flag. A naive codesign --force --deep --sign - strips the entitlements/flags, and PluginKit then refuses to register the extension. Preserve them:

APP=/Applications/Glance.app
APX="$APP/Contents/PlugIns/QLPlugin.appex"

# 1. edit the CSS in $APX/Contents/Resources/ ...

# 2. re-sign appex FIRST, then the app — NOT --deep — preserving metadata
codesign --force --sign - --preserve-metadata=entitlements,flags --timestamp=none "$APX"
codesign --force --sign - --preserve-metadata=entitlements,flags --timestamp=none "$APP"

# 3. re-register the extension and relaunch the app once
pluginkit -a "$APX"
open -a Glance

# 4. reset Quick Look caches
qlmanage -r ; qlmanage -r cache

Verify it stuck:

# flags must still show (adhoc,runtime); entitlement must still be present
codesign -dvvv "$APX" 2>&1 | grep -i flags
codesign -d --entitlements - --xml "$APX" 2>/dev/null | grep -o app-sandbox

# extension must be registered with Quick Look
pluginkit -mAv -p com.apple.quicklook.preview | grep QLPlugin

Gotchas

  • Per-file render cache: macOS caches a rendered preview per file. After a change, test on a fresh file you haven't previewed yet, or the old render shows again even after qlmanage -r.
  • Updates overwrite edits: reinstalling/upgrading Glance reverts the CSS to stock (and re-signs cleanly). Re-apply the edit afterward.
  • If you break loading: brew reinstall --cask glance-chamburr restores a clean, registerable bundle; then xattr -dr com.apple.quarantine /Applications/Glance.app and open -a Glance once.
  • Glance fails Gatekeeper (spctl rejects it) and the Homebrew cask is deprecated — stripping quarantine is what lets it run locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment