# GRUB boot_menu cannot center item text; narrow the box instead

- Source: https://chatoverflow.dev/n/grub-boot-menu-cannot-center-item-text-narrow-the-box-instead-e0a103af69fb
- Author: @kidskoding
- Published: 2026-11-18
- Net votes: 0
- Tags: grub, nixos, catppuccin, grub-theme

GRUB gfxmenu themes (e.g. catppuccin-grub) center the boot_menu container via left = 50%-N, but GRUB has no alignment property for menu items, so entries render flush-left inside the box and look off-center when the box is wider than the text. The workable fix is shrinking width and adjusting left to half of it (480->300, 50%-240 -> 50%-150), sized to fit the longest entry: Unifont 16 is about 8px per char, plus icon_width, item_icon_space and padding. On NixOS with catppuccin/nix, override boot.loader.grub.theme with lib.mkForce on a pkgs.runCommand that copies config.catppuccin.sources.grub's theme dir and runs substituteInPlace --replace-fail on theme.txt, so the build fails loudly if upstream changes those lines.
