Skip to content

Center the Quake console in a 2:1 panel instead of spanning the screen. - #9140

Merged
dhh merged 3 commits into
omacom:quattrofrom
ogarza:center-qconsole
Sep 13, 2026
Merged

dhh merged 3 commits into
omacom:quattrofrom
ogarza:center-qconsole

Conversation

@ogarza

@ogarza ogarza commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The Quake console is a centered half-height panel, twice as wide as it is tall (box = 2 next to share = 0.5), sized by leftover workspace gaps so it refits when the monitor or scale changes.
  • One tiled window keeps that panel. A second tiled app gets the full width back. A floating window on top (btop, Super+O, etc.) does not count.
  • It sizes to the output it actually opens on. A follow_mouse hop onto another screen does not steal the gaps. Quarter-turned monitors swap the work area so the panel is not a sliver.
  • Membership is chased while the console is on screen: window.open, window.destroy, window.move_to_workspace (Super+Shift+1 / Super+Alt+S), and window.update_rules (Super+T / Super+O). window.close is not hooked; it still counts the window on its way out.

Test plan

  • ./test/shell.d/hyprland-qconsole-test.sh
  • Toggle the scratchpad on a 16:9 display: centered 2:1 panel, not full width.
  • Same on an ultrawide / mixed-DPI dock: panel stays 2:1 in logical pixels.
  • Open on one monitor, then open on another with a different aspect ratio without closing it: panel stays 2:1 for that output.
  • With the console open, Super+Alt+S a second tiled window onto it: full width. Super+Shift+1 that window off: panel again.
  • Super+Ctrl+T (btop) while the console is down: panel stays. Super+T that float: full width. Super+T again: panel.
  • Super+O a tiled window on a two-app console: panel re centers.

ogarza and others added 2 commits August 30, 2026 05:26
Size it from leftover workspace gaps so it refits per monitor, and let
omarchy_qconsole_ratio change the width.
The scratchpad spanned the whole screen whatever was on it, which reads as a band rather than a console when it holds the single agent it is usually opened for. It now sizes to a centered panel twice as wide as it is tall, and hands the full width back as soon as a second app is on the scratchpad: two windows splitting a half-width column is worse than the band this replaced.

The panel is still drawn with workspace gaps rather than a window rule, because Hyprland resolves a rule's size once as the window maps and the console has to survive a rescale. It is always flush with the top and always centered, so two numbers describe it, and the memo that suppresses no-op rewrites compares those rather than four edges.

The window count is read on window.open and window.destroy, the two events that run after the workspace's count has settled; window.close and window.move_to_workspace both still count the window on its way out, so refitting from either reads one too many and strands the console at full width. The count is only chased while the console is on screen, since a hidden one is refitted on its way in by workspace.special_active, and every window opened anywhere on the desktop would otherwise rewrite the rule.

Monitor width and height are the panel's own pixels, so an output turned on its side still reports them the way the panel is built rather than the way it hangs. The odd transforms are the quarter turns and those swap the work area: without that a rotated 1920x1080 sized its console from 1920x1080 instead of 1080x1920 and left a 214x1367 sliver.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Codex XHigh <noreply@openai.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed, and this needed changes. The panel arithmetic was correct on an ordinary landscape monitor and dead, vacuous or wrong most other places. Fixes are pushed to center-qconsole as a commit on top of yours, and the behaviour the maintainer asked for — the console goes back to full width as soon as a second app is on the scratchpad — is implemented there as well. default/hypr/qconsole.lua comes out at 184 lines against your 213, with the extra behaviour in it.

Rotated monitors got a sliver. monitor.width and monitor.height are the panel's own pixels and do not change when the output is turned on its side, so a quarter-turned 1920x1080 was sized from 1920x1080 when its work area is really 1080x1920. On that monitor the rule computed side gaps of 433 and a bottom gap of 527, leaving a 214x1367 sliver instead of a panel. config/hypr/monitors.lua documents transform for exactly this setup, so it is a configuration Omarchy supports. Odd transforms now swap the work area. Measured on Hyprland 0.56.2 rather than argued: a headless output at each of the four transforms reports 1920x1080 every time, while a window on it lays out at 1896x1030 for transforms 0 and 2 and 1056x1870 for 1 and 3. With the fix a console on that rotated output measures 1080x947.

Both min_size clamps were dead code. Not "unlikely" — unreachable. bottom is derived as usable_h - h where h is already max(min_size, ...), so usable_h - bottom >= min_size holds by construction, and the width clamp is dead the same way. I brute-forced 904,000 combinations of work area, width and ratio, including fractional scaling and 1-pixel monitors: neither clamp fired once. Removed.

Four defensive guards were dead against the shipping API. if monitor.width then, reserved_edges()'s type(reserved) ~= "table" fallback, if hl.get_workspace then and if hl.exec_scheduled_prop_refresh_immediately then all guard against states Hyprland 0.56.2 does not produce. Checked by asking the running compositor rather than reading the stub: width=1280, reserved is a table with all four edges populated, and both functions exist. The monitor.width one mattered most, because it silently degraded to full width — the exact outcome the PR exists to avoid — and it was only there so the old test fixtures, which deliberately omit width, kept passing. Production code shaped by a fixture. The fixtures now carry width and transform like real monitors do.

is_scratchpad's bare "scratchpad" branch was dead. A special workspace's name is "special:scratchpad", prefix included; confirmed against a live workspace.

A layout change could strand the console on an output that had gone away. monitor.layout_changed preferred ws.monitor, but when that handle's output has been unplugged it answers nil to every field, fit bailed, and there was no fallback to the monitor still present — so the console kept the unplugged screen's gaps. Resolution now goes through one console_monitor() helper that falls back when the handle is dead, and the same helper is used for the initial fit, which fixes the reload case Codex raised: a config reload re-runs the file with the console already on screen, and starting from get_active_monitor() there wrote another output's gaps with no event guaranteed to correct them.

On the multi-window behaviour, the event you pick decides whether it works. Measured on a live compositor, with the scratchpad's windows count read inside each handler:

event count when the handler runs
window.open already includes the new window
window.destroy already excludes the closed one
window.close still counts the window that is closing
window.move_to_workspace still counts the window that is leaving
workspace.special_active current, and passes (ws, mon)

So the implementation hangs off window.open and window.destroy; hanging it off window.close or window.move_to_workspace reads one too many and strands the console at full width after you close back down to one. The count is only chased while the console is on screen — a hidden one is refitted on its way in by workspace.special_active anyway, and otherwise every window opened anywhere on the desktop rewrites the scratchpad rule. There is a test asserting window.close is not hooked, with the reason, so this does not get "fixed" back.

Verified end to end on Hyprland 0.56.2, not just in unit tests. On a 1280x800 output with a 26px bar: one window measures at=(253,26) size=(774,387), a second app gives (0,26) 640x387 and (640,26) 640x387, and closing one returns it to (253,26) 774x387.

Two calls are yours, not mine.

The first is that I dropped omarchy_qconsole_ratio and made the width a local box = 2 next to the existing local share = 0.5. Three reasons: the file already keeps exactly this kind of number as a local, so the knob was inconsistent with its own neighbour; it was a _G global read on every fit; and — the part that is a bug rather than taste — it only existed in config/hypr/hyprland.lua, which is a template copied at install. With no migration, every existing user would have kept nil and seen no change at all, while manual/04-navigation.md told them a centered panel was the default. As a plain constant the new behaviour actually reaches everyone and needs no migration. If you want the knob back it is a small change, but it needs a migration to be true.

The second is that "more than one app" is read literally as ws.windows > 1, so a floating utility on the scratchpad also returns it to full width. Counting only tiled windows is a one-line change if you meant it narrowly.

What was checked. The full shell suite, 215 files: 2 failures, theme-install-guards-test.sh and windows-vm-mount-boundary-test.sh, both of which fail identically on this branch with my changes stashed, so they are pre-existing and unrelated. The qconsole tests were then mutation-tested — 12 deliberate breaks of the fix, including removing the transform swap, hanging the refit off window.close, dropping the dead-output fallback and inverting the window-count comparison; all 12 fail the suite. One of my own new tests survived its mutation on the first pass, because it asserted values the previous rule already held; it was rewritten until it could actually fail. What was not checked: whether a second app opening produces a one-frame flash of the centered panel before the gaps are rewritten. hl.exec_scheduled_prop_refresh_immediately() is called on every rule change to land it in the same pass, and the final geometry is right, but I did not capture frames to prove nothing flickers.

The second opinion was Codex at xhigh reasoning effort, run read-only against the PR commit. It independently reached the same conclusions on the dead guards, the dead min_size clamps, the dead "scratchpad" branch, the fixture-shaped monitor.width path and the missing migration — though its independence is not guaranteed, since my prompt named those areas as suspicions and it read the same API stub I did. What it found on its own, and I had missed, is the monitor rotation defect; that one is its finding, verified against the live compositor before being acted on, and it earns a Co-Authored-By on the commit. I did not take two of its suggestions: coalescing window events through a zero-delay hl.timer, and using window.open_early with a projected count, both of which add asynchrony to buy a frame that the immediate refresh already appears to cover. Its verdict on your commit as it stood was DON'T MERGE, chiefly because the requested multi-window behaviour was absent.

Waiting on the maintainer for the two calls above. Nothing is needed from you unless you disagree with the rewrite.

@ogarza

ogarza commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

I just tested these changes you pushed and it is much improved!

Love that opening a second window just expands it back.

A floating window on the console is not laid out by the gaps, so it no
longer stretches the panel to full width. Moving an app onto or off the
scratchpad and toggling floating now refit too, via
window.move_to_workspace and window.update_rules; both were measured on
Hyprland 0.56.2 to carry the settled count.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012UyVoFTM98Tduoxg7qZax7
@dhh

dhh commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Pushed d377569 on top, closing two gaps between the description and the code:

  • Only tiled windows count. alone() read ws.windows, so a floating btop on the console blew it out to full width. The gaps only lay out tiled windows, so it now counts non-floating windows via hl.get_workspace_windows.
  • Moves and float toggles refit. Only window.open/window.destroy were hooked, so Super+Alt+S a second app onto the console left both squeezed into the panel, and moving it off again left the console full width. window.move_to_workspace and window.update_rules are now hooked too. Measured on a live Hyprland 0.56.2 with the same dispatcher Super+Alt+S uses: move_to_workspace already carries the settled count, and every move and float toggle is trailed by several update_rules, the last of which always does. The earlier ones refit to the rule that is already there, which cover() skips.

Tests cover float-on-console, tile/float toggles, and moves on and off; each of the three fixes was reverted in turn and the suite failed every time. All 11 hyprland tests pass on the branch merged into current quattro, and loading the merged qconsole.lua into a live session applied gaps of [0, 671, 833, 671] on a 3008x1692 display with a 26px bar — the expected centered 1666x833 panel.

@dhh
dhh merged commit 692c02c into omacom:quattro Sep 13, 2026
dhh added a commit to mwikala/omarchy that referenced this pull request Sep 13, 2026
The rename predates omacom#9140, which turned the workspace name into a constant
the panel now reads for its window count and its open/move handlers. One
CONSOLE constant names special:qconsole everywhere, so the console is
sized off its own workspace rather than the scratchpad's.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012UyVoFTM98Tduoxg7qZax7
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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.

4 participants