From 83ff4d112bc59884e514fa1f88860f1ab02a8457 Mon Sep 17 00:00:00 2001 From: Vidhan Bhatt Date: Thu, 20 Nov 2025 12:12:54 -0500 Subject: [PATCH] ghostty: scale font on darwin (#1988) Link: https://github.com/nix-community/stylix/pull/1988 Reviewed-by: Ian Holloway <72767437+IanHollow@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- modules/ghostty/hm.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/ghostty/hm.nix b/modules/ghostty/hm.nix index f4a1668d..5ebb8ef6 100644 --- a/modules/ghostty/hm.nix +++ b/modules/ghostty/hm.nix @@ -1,7 +1,7 @@ # Documentation is available at: # - https://ghostty.org/docs/config/reference # - `man 5 ghostty` -{ mkTarget, ... }: +{ mkTarget, pkgs, ... }: mkTarget { name = "ghostty"; humanName = "Ghostty"; @@ -15,7 +15,16 @@ mkTarget { fonts.monospace.name fonts.emoji.name ]; - font-size = fonts.sizes.terminal; + + # Ghostty font-size is specified in points (pt) on all platforms. + # Ghostty's default DPI is 96 on Linux and 72 on macOS. + # fonts.sizes.terminal is in pt size so no changes on Linux are needed, + # but to match visual size on macOS we scale it by 4/3 = 96/72. + font-size = + if pkgs.stdenv.hostPlatform.isDarwin then + fonts.sizes.terminal * 4.0 / 3.0 + else + fonts.sizes.terminal; }; } )