Fit the presentation terminal to its logo instead of a fixed 875x600 - #9281
Open
londospark wants to merge 3 commits into
Open
Fit the presentation terminal to its logo instead of a fixed 875x600#9281londospark wants to merge 3 commits into
londospark wants to merge 3 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 genericfloating-windowtag). That size is only wide enough for the 81-column logo at the default terminal font. At a bumpedomarchy display text-size, the window is too narrow and the logo wraps mid-glyph:Before:

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-aboutdocuments for its own window. I initially tried setting the size declaratively (both a statico.windowrule in Hyprland config, and ahl.window_ruleinjected viahyprctl evalimmediately before spawning, mirroringomarchy-launch-about'sapply_size_rule/presize_windowpattern). 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--renderthe same wayomarchy-launch-aboutdoes.What's sized, and how
wc -Lonlogo.txt) plus a little padding. Not hardcoded, so a rebranded logo is measured correctly.~/.local/state/omarchy/windows/presentation.fit) and re-applied viapresize_window/apply_size_rule, mirroringomarchy-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 throughps -o ppid=) to the Hyprland client Hyprland reports for this class, rather thanhyprctl activewindow. I triedactivewindowfirst, matchingomarchy-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-presentationtest/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 cleanquattrocheckout)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.