Skip to content

Fit the presentation terminal to its logo instead of a fixed 875x600 - #9281

Open
londospark wants to merge 3 commits into
omacom:quattrofrom
londospark:fix-presentation-terminal-text-size
Open

Fit the presentation terminal to its logo instead of a fixed 875x600#9281
londospark wants to merge 3 commits into
omacom:quattrofrom
londospark:fix-presentation-terminal-text-size

Conversation

@londospark

@londospark londospark commented Aug 31, 2026

Copy link
Copy Markdown

Disclosure: this fix was built with AI assistance (Claude Code) -- the investigation, implementation, and this description were largely vibe-coded. I reviewed and tested everything below on my own machine before opening this, but wanted to be upfront about how it was made.

Summary

The branded floating terminal used for installs, wifi setup, fingerprint setup, and updates (omarchy-launch-floating-terminal-with-presentation) opens at a Hyprland float rule hardcoded to 875x600px (default/hypr/apps/system.lua, shared with the generic floating-window tag). That size is only wide enough for the 81-column logo at the default terminal font. At a bumped omarchy display text-size, the window is too narrow and the logo wraps mid-glyph:

Before:
before

After:
after

Why this needs measuring, not a rule

The size that fits the logo depends on the terminal's actual cell metrics, which can only be read from inside a running terminal -- the same constraint omarchy-launch-about documents for its own window. I initially tried setting the size declaratively (both a static o.window rule in Hyprland config, and a hl.window_rule injected via hyprctl eval immediately before spawning, mirroring omarchy-launch-about's apply_size_rule/presize_window pattern). Neither affected the size a new window actually opens at, in any ordering or timing I tried. The only thing that reliably resizes the window is an imperative resize dispatched after it exists, so that's what this does, self-relaunching with --render the same way omarchy-launch-about does.

What's sized, and how

  • Columns: the logo's real display width (wc -L on logo.txt) plus a little padding. Not hardcoded, so a rebranded logo is measured correctly.
  • Rows: not a flat number, and not derived from the logo's own height either (its 10 lines have nothing to do with how tall this window should be). Instead: scale the pixel width the column target needs at the window's current cell size, apply the old 875x600 rule's own width:height ratio to get a pixel height, then convert that back to a row count at the current row height. The window ends up the same shape as the one it replaces, just as wide as the logo actually needs.
  • The fitted size is cached (~/.local/state/omarchy/windows/presentation.fit) and re-applied via presize_window/apply_size_rule, mirroring omarchy-launch-about's own caching -- though as noted above, I couldn't get this to actually change the window's opening size, so in practice the live nudge below still runs on every launch. Kept for consistency with the established pattern and in case it behaves differently elsewhere; happy to drop it if that's dead weight.

A bug caught along the way

The window is matched via a small own_client() helper that walks this process's own ancestry ($$ up through ps -o ppid=) to the Hyprland client Hyprland reports for this class, rather than hyprctl activewindow. I tried activewindow first, matching omarchy-launch-about's pattern, but it silently returns nothing -- skipping the fit entirely -- whenever the popup doesn't hold focus, which happens whenever something else grabs focus while the terminal is still spawning. Caught this because a stray terminal from earlier testing had focus during a re-run and the fit didn't apply at all.

Testing

  • bash -n bin/omarchy-launch-floating-terminal-with-presentation
  • test/shell.d/floating-terminal-test.sh -- passes
  • ./test/all -- no new failures (4 pre-existing failures unrelated to this file: bar-icon-geometry-test.sh, config-test.sh, snapper-test.sh, unowned-system-paths-test.sh; confirmed these fail identically on a clean quattro checkout)
  • Manual verification on a live Hyprland/Omarchy session at both the default text size and a bumped one (omarchy display text-size 14): logo renders cleanly at both, final window shape matches the old box's aspect ratio (~1.48 vs. the original 875x600's 1.46), and the fit still applies correctly when the popup doesn't have focus (the bug described above)

Note on scope

I run a small local Quickshell plugin as a stopgap on my own machine (external to this repo, since I can't presize the window without this fix) -- not part of this PR, just flagging that I've been dogfooding the underlying behavior beyond this one script for a while.

The branded floating terminal used for installs, wifi setup, fingerprint
setup, and updates opens at a hardcoded 875x600px, sized for the default
terminal font. At a bumped `omarchy display text-size` the window is no
longer wide enough for the 81-column logo, which wraps mid-glyph into an
unreadable mess.

The size that hugs the logo depends on the terminal font, so it can only
be measured from inside the terminal -- the same approach
omarchy-launch-about uses for its own window. Column target comes from
the logo's real width; row target preserves the old 875x600 rule's own
aspect ratio at whatever width the logo needs, rather than a flat row
count that would leave the window a different shape than before.

The window is matched by walking this process's own ancestry rather than
`hyprctl activewindow`, since the popup isn't guaranteed to hold focus
and activewindow silently matches nothing (skipping the fit) when it
doesn't.
own_client() only matched a client whose pid was in this script's own
process ancestry, which never finds the window when the terminal runs
as a persistent server (e.g. `foot --server`) -- the process that maps
the window there isn't a descendant of this script. Since org.omarchy.terminal
is exclusive to this launcher, fall back to the sole client of that class
when the ancestry walk finds nothing, and stay silent when that's still
ambiguous (more than one match).

fit_window() divided by a window height that could read as 0 in the
brief window before Hyprland finishes populating a just-mapped client's
geometry, silently driving a bad resize; guard it the same way the nudge
loop already guards its own read.

The window-rule cache (presize_window/apply_size_rule/remember_fit) was
confirmed in the PR description to have no effect on the size a window
opens at, so drop it rather than ship it as dead weight next to the live
nudge that actually works.

own_client()'s ancestry walk is a real ps/hyprctl round trip per ancestor;
fit_window() called it before the loop and again on every nudge. Resolve
the client once and read updated geometry through a plain by-address
lookup for the rest of the fit.

The --render branch relied on `exec` to make the rest of the file
unreachable instead of an explicit if/else, against this repo's
convention for two-path control flow. A stray quoted variable in a
numeric [[ ]] comparison is fixed to match it too.

Extends test/shell.d/floating-terminal-test.sh to cover the fallback
match, the ambiguous-refusal case, the height-0 guard, the dropped
cache, and that the client is resolved once per fit.
settle_grid() and hypr_dispatch() were byte-for-byte copy-pasted from
omarchy-launch-about into the presentation launcher's own review round.
Move them into a shared, sourced helper now that both callers need
exactly the same behavior, so a future change to the resize/settle
mechanism only has to happen once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant