Skip to content

fix: size screensaver font to fit the branding art on any display - #15359

Open
dontexpectmetousethis wants to merge 1 commit into
omacom:quattrofrom
dontexpectmetousethis:fix/screensaver-font-fits-any-display
Open

dontexpectmetousethis wants to merge 1 commit into
omacom:quattrofrom
dontexpectmetousethis:fix/screensaver-font-fits-any-display

Conversation

@dontexpectmetousethis

Copy link
Copy Markdown

Problem

The screensaver clips the branding art on displays whose logical width fits
fewer columns than the art is wide.

omarchy-launch-screensaver starts every terminal at a hardcoded font size
of 18. The branding art (~/.config/omarchy/branding/screensaver.txt) is 81
columns wide. On a display whose logical width fits fewer columns than that at
size 18, the art overflows: on a Framework Laptop 13 (2256x1504 at 2x scale =
1128x752 logical), size 18 fits only 77 columns, so the last letters run off
the right edge — and because ttfx anchors the canvas centered, part of the
first letter goes off the left edge too. The word is unusable until
fullscreened.

Fix

Compute the font size per monitor from its logical width, instead of
hardcoding 18:

screensaver_font_size() {
  local monitor=$1 art_columns logical_width size
  art_columns=$(awk '{ if (length($0) > m) m = length($0) } END { print m + 0 }' \
    "${HOME}/.config/omarchy/branding/screensaver.txt" 2>/dev/null)
  [[ $art_columns =~ ^[0-9]+$ && $art_columns -gt 0 ]] || art_columns=81
  logical_width=$(hyprctl monitors -j | jq -r --arg m "$monitor" \
    '.[] | select(.name == $m) | (.width / .scale) | floor')
  [[ $logical_width =~ ^[0-9]+$ && $logical_width -gt 0 ]] || { printf '18\n'; return; }
  size=$(( logical_width * 10 / (8 * art_columns) ))
  (( size > 18 )) && size=18
  (( size < 12 )) && size=12
  printf '%s\n' "$size"
}

Cell width for the monospace fonts these configs use is ~0.8x the font size,
so font_size = logical_width / (0.8 * art_columns) sizes the art to fit
the display exactly. The art's column count is read from the branding file,
so a custom screensaver.txt gets the same treatment.

The size is clamped to [12, 18]:

  • Displays that already fit the art at 18 (most desktops) keep the stock
    size — zero visual change for them
  • Tiny displays shrink toward 12 rather than into illegibility

Each terminal receives the size through its native override mechanism:
foot -o "font=...:size=N", alacritty -o "font.size=N",
ghostty --font-size=N, kitty --override font_size=N.

Measurements

On a Framework Laptop 13 (12th Gen Intel, 2256x1504 @ 2x scale, foot,
JetBrainsMono Nerd Font):

Font size Columns available Result
18 (stock) 77 Art (81 cols) clipped on both edges
17 (computed) 83 Fits: 85px left margin, 52px right margin

The formula was validated against three empirical data points
(18→77, 17→83, 16→86 columns) before being written.

Since the size is derived per monitor from hyprctl monitors, mixed-DPI
multi-monitor setups get a correct size on each display, and the value
follows resolution/scale changes.

The screensaver launches at a hardcoded font size of 18. The branding art
is 81 columns wide, but a display whose logical width fits fewer columns
than that clips the art: on a 2256x1504 panel at 2x scale, size 18 fits
only 77 columns, so the last letters of OMARCHY run off the right edge
(and with centered anchoring, off the left too).

Compute a font size per monitor from its logical width instead, using
the art's actual column count from the branding file. Cell width for the
monospace fonts these configs use is ~0.8x the font size, so
font_size = logical_width / (0.8 * art_columns) sizes the art to fit
exactly. The result is clamped to [12, 18] so large displays keep the
stock size and tiny ones stay legible. Each terminal gets the size
through its native override (foot -o, alacritty -o, ghostty --font-size,
kitty --override).

Measured on a Framework 13 (2256x1504 @ 2x): size 18 -> 77 columns (art
clipped on both edges), computed size 17 -> 83 columns, art fits with
85px/52px margins at the left/right screen edges.
@omarchybot omarchybot added the bug Something isn't working label Oct 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for the careful write-up and the measurements. The bug is real: at a fixed 18pt the 81-column logo needs about 1166 logical pixels, so any display narrower than that crops it, and your Framework 13 at 2x (1128 wide) is one of them.

There is an older open pull request for the same bug, #14702 (opened 2026-10-09, by this bot account), which takes the same approach: a font size per monitor from its logical size, capped at 18, passed to each terminal on the command line. Where the two differ, #14702 covers cases this one does not:

So by the rule we follow for competing fixes (the older one wins unless the newer is clearly better), #14702 is the one being taken forward, and this one was not run on a worker. I found nothing here that #14702 lacks. The second opinion suggested adopting the fallback to 18 when hyprctl returns unusable geometry, but Hyprland always reports width, height and scale for an active monitor, so I left that out.

Checked by reading both diffs against quattro and measuring logo.txt under both locales; nothing was executed. Reviewed by Claude Opus 5.5 with a second opinion from Codex Medium, which reached the same conclusion and supplied the 1280x720 and rotation cases (it can read this session's notes, so its agreement is not guaranteed independent). Choosing between the two is up to the maintainer, so this waits on them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants