Skip to content

Clamp notification cards to the width the screen has - #11034

Open
SimonSchubert wants to merge 1 commit into
omacom:quattrofrom
SimonSchubert:notification-card-max-width
Open

SimonSchubert wants to merge 1 commit into
omacom:quattrofrom
SimonSchubert:notification-card-max-width

Conversation

@SimonSchubert

@SimonSchubert SimonSchubert commented Sep 9, 2026 •

Copy link
Copy Markdown

What changes

Notification cards overflow any screen narrower than the card. The deck's cards are Style.space(380) wide (up to 560 for one-line toasts) whatever the screen, and the deck is anchored right, so on a narrow screen it runs off the left edge: the border and the first characters of every line are cut off.

This was first written against the old NotificationCard.qml, which 4671ae2's new engine replaced, so it has been rewritten for the new engine:

  • Delivery.cardWidthLimit(widest, screenWidth, margins) caps a card at the room between the deck's left and right margins, and leaves widest alone wherever it fits.
  • Each surface's maxCardWidth passes through it, and the toast's baseWidth (body and button cards) is capped by the same limit, so both the fixed column and one-line cards that fit their text stay on screen.
  • Delivery.deckMargins now returns a left margin too: the same gap as the right edge, plus the bar's thickness when the bar is on the left.

On screens wide enough for the card nothing changes.

Verification

  • test/shell.d/notifications-test.sh passes. logic.cjs now checks left in deckMargins for all four bar positions, and cardWidthLimit at a wide screen, at 320 px with the bar on top and on the left, at a fractional width, and at a zero width.
  • Ran the shell from each tree in the nested headless Hyprland (test/headless, under a private dbus-run-session), with HEADLESS-1 at 640x480, scale 2 (320 logical px), and sent a toast over org.freedesktop.Notifications:
    • quattro (94c92b2): hyprctl layers puts omarchy-notifications at x=-84, w=404. The card's left border and the first letter of each line are off-screen.
    • this branch: x=-4, w=324 (the transparent motion inset). The card sits 10 px from both edges.
  • Same run at 1920x1080 scale 1: the layer is x=1336, w=584 on both trees, so wide screens are unchanged.
  • Not checked: a real narrow device, and a bar on the left at runtime (covered only by the unit test).

Screenshots

320 logical px wide, the same toast:

quattro this branch

@SimonSchubert
SimonSchubert force-pushed the notification-card-max-width branch from 7eb0d1e to 511d2c6 Compare September 9, 2026 19:47
@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 511d2c6 and reproduced on a worker built from the Omarchy ISO, with the shell running from each tree under test. I set its display to 1280x800 portrait at scale 2.5, which is 320 logical pixels wide, and sent a toast. On current quattro the card loses its left border and the first characters of every line, exactly as described. At this head it fits with both borders and an even gap, and with the two files reverted the clipping comes back. Merged into current quattro (the branch is 274 commits behind, and the merge is clean) the fix still holds. At scale 1 the card measures 380 pixels on both quattro and this branch, so desktops are unchanged.

./test/cli passes at the head, and so do notifications-test.sh, notification-send-test.sh and migrate-notify-test.sh through the compositor-wired runner. Merged into quattro, ./test/cli has one failure (vscode generated theme references current theme file), which fails the same way on quattro itself and has nothing to do with this change.

The second opinion, Codex Medium, reviewed the diff and found no actionable defect; it agreed with the approach, and its independence from this review is not guaranteed. It did point out that when the screen is narrower than the gap plus the bar clearance, maxWidth goes to zero or below and the card falls back to full width. No display is that narrow, so I left it alone.

#12666 fixes the same overflow with Math.min(Style.space(380), Screen.width * 0.8). Because this one uses the popup's real margins, it keeps the full 380 wherever it fits and leaves room for a bar on the right edge, and it does not carry #12666's unrelated low-battery urgency change. Separately, #11394 and #10270 shrink the popup window to a strip Style.space(380) + margins.right wide. If either lands alongside this one, maxWidth works out to 380 minus the left gap on every screen, and their test asserting implicitWidth: Style.space(380) in NotificationCard.qml would fail. Whichever lands second needs to account for the other.

Nothing is left for you to do here. This is waiting on the maintainer.

@jandrusk

Copy link
Copy Markdown

Confirmed the overflow on narrow screens — clamping to the container width is the right fix.

#12666 also clamps toast width (plus battery-warning auto-expire). Please coordinate so we don't merge two competing clamps; happy to take the card-width half from this PR if #12666 keeps the battery bit.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 20, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This no longer merges, and the conflict can't be resolved by merging. quattro replaced the notification engine in 4671ae2, which deleted shell/plugins/notifications/components/NotificationCard.qml and rewrote the popup part of Service.qml. The popupWindow.popupPlacement that the new binding reads is gone too. Bringing this across would mean writing a new fix in different files, so I haven't pushed anything to the branch.

The bug is still there. I linked current quattro (087f73d) as the running shell on a worker built from the Omarchy ISO, set its display to 1280x800 portrait at scale 2.5 (320 logical pixels wide) and sent a toast. The left border and the first characters of every line were cut off, as in your before screenshot. hyprctl layers puts the notification surface at x=-79 and 399 pixels wide on that 320-pixel output. The new engine fixes the width at notificationWidth: Style.space(380) (Service.qml:199). That value sizes the clipper and deck (Service.qml:1794, :1801) and goes on to Toast.cardWidth (Service.qml:1879, Toast.qml:232), and nothing clamps it to the output.

Codex Medium reviewed this separately and agreed on each point: the file is gone, the overflow persists on quattro, and the patch can't be ported as it stands although the idea can. It also judged the original fix proportionate and found no defect in it against the old engine. It could read this session's notes, so treat that as agreement, not an independent check.

Next step is the maintainer's call: close this and bring the clamp to the new engine (Service.qml's notificationWidth and the surface width built from it), either in a new pull request from you or as a fix from omabot.

The deck's cards are 380 wide (up to 560 for one-line toasts) whatever
the screen. On a screen narrower than that the deck, anchored right,
runs off the left edge, cutting off the card's border and the first
characters of every line.

Cap each surface's card width at the room between its left and right
margins, and give the left edge the same gap as the right, plus the
bar's thickness when the bar sits there.
@SimonSchubert
SimonSchubert force-pushed the notification-card-max-width branch from 511d2c6 to 73180c7 Compare November 30, 2026 13:01
@SimonSchubert SimonSchubert changed the title Clamp notification cards to the width their container has Clamp notification cards to the width the screen has Nov 30, 2026
@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Caps notification cards to the screen width minus both side margins.

  • Notification cards fit within the width each screen has.

No actionable issues found. This review checked code; it did not run tests or the UI.

Reviews (1) · Last reviewed commit: "Clamp notification cards to the width th..." · Reviewed by Greptile

@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Dec 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

On a disposable Omarchy ISO worker at 320 logical pixels wide, quattro clipped the left border and app badge. Both fit on 73180c7 and on a clean merge into quattro. Reverting the fix brought the clipping back. Title-only toasts and toasts with actions fit, and the card cleared a left-side bar. The CLI suite and all 42 checks in the three notification test files passed on the PR head.

Codex High, Opus 5.5 High and muse-wonder via pi, thinking high reviewed the width and margin bindings and found no blocking defects. The second opinions agreed on the geometry, and their independence from this review is not guaranteed.

On quattro, the left border and app badge are clipped

On 73180c7, both borders and the app badge are visible

The Tests and Check translation structure workflows still need a maintainer to approve them and let them run.

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

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants