Repository navigation
Fit screensaver art to the monitor scale - #7307
vitalibondar wants to merge 6 commits into
Conversation
ttfx does not scale its input art -- it renders it into whatever canvas the terminal provides. Because the launcher hardcodes an 18 pt font, the number of rows available depends on the monitor scale, and the branded art is silently cropped once it no longer fits. On a 1920x1080 panel at scale 1.6, an 18 pt JetBrains Mono cell leaves 21 rows while the stock art is 26 rows tall: five rows are lost off the top and bottom of the logo. Users who raise the scale for accessibility reasons hit this immediately, and lowering the scale is not an acceptable workaround. Measure the art and derive the font size per monitor instead. The size is capped at the current 18 pt, so anything that fits today keeps rendering exactly as before; it only shrinks when the art would otherwise be cut off. Monitor rotation is taken into account, and a user-provided art file in ~/.config/omarchy/branding takes precedence over the stock one. Verified on foot at scales 1.0 through 2.5 -- the art fits at every step.
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Tested this branch's
So the transform swap covers the portrait case that was raised on #9045. One detail: on the portrait monitor at 16, the wordmark spans x = 26 to 1079 of 1080 px. That leaves about 1 px on the right, against 26 px on the left. It fits, but with almost no margin. A slightly larger cell-width factor than 0.8 (or |
Ghostty draws the JetBrains Mono cell slightly wider than 0.8x the font size, so on a 1080 px wide portrait monitor the 81-column wordmark fit with about 1 px to spare. Use 0.82 and two spare columns: that monitor now gets 15 pt instead of 16, everything else is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011N1mzAKJygEkcHAHV1776r
|
Thanks for testing this on a portrait setup, that's the case I couldn't check myself. You're right about the margin. Your numbers also show that Ghostty draws the cell a bit wider than foot: 81 columns over 1053 px at 16 pt is about 0.81x the font size, not 0.8x. On its own, |
|
wc -l counts newline characters, so an art file that does not end with a newline loses its last row, and a one-line logo gets zero rows. With zero rows the launcher skips fitting and falls back to 18 pt, so a wide one-line logo stays cropped. awk's NR counts the last line either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011N1mzAKJygEkcHAHV1776r
omarchy-screensaver always passes ~/.config/omarchy/branding/screensaver.txt to ttfx. The two fallbacks under $OMARCHY_PATH do not exist in the repository, and if they did, the font would be sized for art that is not on screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stock logo is drawn in three-byte block characters. Under a non-UTF-8 locale awk's length() counts bytes, so the 81-column logo measured 197 and the font shrank to 6pt on a 1080p monitor at scale 2, and to 11pt even at scale 1. The test runs the launcher under LC_ALL=C on a scale-1 and a scale-2 monitor and checks the size each gets. Co-Authored-By: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed and verified at What was run, on a disposable Omarchy ISO VM with foot as the terminal and a 1280x800 display:
Pushed to this branch:
Competing fix: #14702 fixes the same bug the same way. This one was first, and on the stock logo both pick the same size, so this is the one brought forward. Its locale handling is folded in above. Second opinion: Codex Medium reviewed the diff over two rounds and found nothing blocking at this head; its agreement may not be fully independent of my review. It also pointed out a limit in both pull requests. Custom art that contains tab characters is measured as narrower than ttfx draws it, because ttfx expands tabs to four-column stops. Neither the stock logo nor This fixes #9027. #15253 looks like something else: at 2560x1600 and scale 2 this branch keeps 18pt, which fits 88 columns, so a 54-column grid there points at something other than font size. Waiting on the maintainer. |
|
@vitalibondar, this now conflicts with #9027 probably still happens with the native screensaver. I worked this out from the source of #14702 takes the same terminal-based approach, so Second opinion: Codex Medium and muse-wonder (pi, high thinking) both checked these points. Both found that nothing in this PR applies to Waiting on the maintainer. My recommendation is to close this as superseded by the native screensaver and to track the remaining clipping against |
Problem
ttfxdoes not scale its input art — it renders it into whatever canvas the terminal provides.omarchy-launch-screensaverhardcodes an 18 pt font, so the number of rows available depends entirely on the monitor scale. Once the art no longer fits, it is silently cropped: the top and bottom of the logo simply fall off the screen, with no warning.Concrete numbers from a 1920x1080 panel at scale 1.6:
An 18 pt JetBrains Mono Nerd Font cell is ~14.4x31.68 px, so the usable row count is
(height / scale) / 31.68. The crop starts at roughly scale 1.3 and gets worse from there.This is easy to miss because it looks like a broken image rather than a layout problem, and the people most likely to hit it are those who raise the display scale for accessibility reasons — for whom "just lower the scale" is not a workaround.
Change
Measure the art once and derive the font size per monitor:
The 0.8 and 1.76 factors are the JetBrains Mono cell aspect expressed relative to font size (verified against the 14.4x31.68 px cell at 18 pt). One spare row and column keep the art off the very edge.
Notes on the implementation:
~/.config/omarchy/branding/screensaver.txtis measured if present, so a custom logo gets the same treatment as the stock one.All four supported terminals accept the size on the command line, so no config files needed to change.
Testing
Tested on
footat scales 1.0, 1.25, 1.5, 1.6, 1.75, 2.0 and 2.5 with a 26-row custom logo: the art fits at every step, and at 1.0 and 1.25 the resulting size is still the stock 18 pt.Fixes #9027