Variable: ghostel-cell-pixel-scale

ghostel-cell-pixel-scale is a customizable variable defined in ghostel.el.

Value

auto

Documentation

Physical-to-logical pixel ratio for cell-size reporting.

Used when answering XTWINOPS queries (CSI 14/16 t) and when telling libghostty's kitty graphics protocol the cell dimensions. Image tools — timg, yazi, tmux passthrough — query the terminal for cell pixel size to compute placement dimensions; if the value reported is smaller than what the standalone Ghostty terminal would report, they either fall back to half-block rendering (timg) or fill more cells than expected with upscaled, blocky output (yazi).

auto computes the display DPI from display-mm-width and display-pixel-width and uses DPI/96 directly as a float. Standard
~96 DPI displays resolve to ~1.0; HiDPI displays (~150 DPI) resolve
to ~1.5; ~192 DPI displays to ~2.0. If the display's physical size isn't reported (some multi-monitor setups, virtual displays), falls back to 1.

This is a heuristic — Emacs has no portable API for the OS-level backing scale factor, so exact parity with standalone Ghostty
(which measures cell size in real physical pixels via the window
server) requires setting an explicit number here. Useful overrides: the exact physical_cell_w / default-font-width ratio (e.g. 2.28) for pixel-perfect parity with standalone Ghostty's image rendering, or
1 to opt out of HiDPI-aware reporting altogether.

Note that image-scaling-factor is *not* a useful signal here: Emacs's auto resolves it from frame-char-width (a font-width heuristic for image-vs-text scaling), not from the display's DPI or backing scale factor.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defcustom ghostel-cell-pixel-scale 'auto
  "Physical-to-logical pixel ratio for cell-size reporting.

Used when answering XTWINOPS queries (CSI 14/16 t) and when telling
libghostty's kitty graphics protocol the cell dimensions.  Image
tools — timg, yazi, tmux passthrough — query the terminal for cell
pixel size to compute placement dimensions; if the value reported is
smaller than what the standalone Ghostty terminal would report, they
either fall back to half-block rendering (timg) or fill more cells
than expected with upscaled, blocky output (yazi).

`auto' computes the display DPI from `display-mm-width' and
`display-pixel-width' and uses DPI/96 directly as a float.  Standard
~96 DPI displays resolve to ~1.0; HiDPI displays (~150 DPI) resolve
to ~1.5; ~192 DPI displays to ~2.0.  If the display's physical size
isn't reported (some multi-monitor setups, virtual displays), falls
back to 1.

This is a heuristic — Emacs has no portable API for the OS-level
backing scale factor, so exact parity with standalone Ghostty
\(which measures cell size in real physical pixels via the window
server) requires setting an explicit number here.  Useful overrides:
the exact `physical_cell_w / default-font-width' ratio (e.g. 2.28) for
pixel-perfect parity with standalone Ghostty's image rendering, or
1 to opt out of HiDPI-aware reporting altogether.

Note that `image-scaling-factor' is *not* a useful signal here:
Emacs's `auto' resolves it from `frame-char-width' (a font-width
heuristic for image-vs-text scaling), not from the display's DPI
or backing scale factor."
  :type '(choice (const :tag "Auto-detect from display DPI" auto)
                 (number :tag "Explicit ratio")))