Skip to content

Issue #1882: stack the pill and the messages - #1883

Merged
emmertex merged 1 commit into
emmertex:stagingfrom
clydecbrown:classic/feat/pill-in-stack
Dec 4, 2026
Merged

emmertex merged 1 commit into
emmertex:stagingfrom
clydecbrown:classic/feat/pill-in-stack

Conversation

@clydecbrown

Copy link
Copy Markdown
Collaborator

Fixes #1882

Problem

The on-screen overlay (the pill) and the messages at the bottom of the window were placed by two separate pieces of code that did not know about each other. Both sit near the same edge, and Settings lets a person put them at the same position, so a pill and a message could be drawn on top of one another.

Change

  • New crates/ui-egui/src/stack.rs: one function places the pill and the messages. Each box keeps the distance from its edge that its own settings give it; when two would overlap, the later one keeps its place and the earlier one moves inward, with 8 points between them. A box that does not fit in the view is not drawn.
  • The pill keeps the place it got when it appeared while a slider updates it, so a message arriving moves it inward once and updates do not move it again. It stays inward when that message leaves, until it fades or its position setting changes.
  • The pill and the messages keep their own painting. surface_osd::paint now draws into the rectangle it is given. The message with a button still draws itself; the stack makes room for it using its height from the last frame.
  • ui.inspect has a new stack field: the pill and the messages, oldest first, each with kind, text, edge, rectangle and seconds left (docs/control-protocol.md).
  • The manual page Notifications says how they stack, with a What's New and a changelog entry.

Not in this PR: an animation when a box moves, and a limit on how many boxes the pill can sit behind (it simply is not drawn when there is no room). The limit of three messages is unchanged and does not count the pill.

Acceptance criteria

  • AC-1: one layout function places the pill and the messages and makes room for the message with a button — stack::layout and stack::place; surface_osd::paint takes the rectangle, and panels::toast reads its rectangles from the stack.
  • AC-2: a pill and messages never overlap at any pair of positions — a_pill_and_a_message_never_overlap_at_any_pair_of_positions covers all 16 pairs of the four positions, in both arrival orders (seen failing first: on the old placement the pill drew over the message).
  • AC-3: a pill that updates keeps its place — a_pill_that_updates_keeps_its_place_in_the_stack, a_pill_does_not_jump_when_the_message_in_front_of_it_leaves and changing_the_pills_position_puts_it_at_the_new_positions_own_place; the last two were each seen failing with the remembered distance, or its position check, taken out.
  • AC-4: the pill stays off the photo while a tool is in use and a slideshow's messages stay at the top — unchanged rules, still covered by the_overlay_stays_off_the_photo_while_a_tool_is_in_use and the slideshow message tests.
  • AC-5: ui.inspect shows the stack in order with kind, text and seconds left — inspect_lists_the_pill_and_the_messages_in_the_order_they_arrived.
  • AC-6: a headless test fails if they overlap, if the order is wrong, or if one's timer changes the other's — the overlap test above checks overlap and order; the inspect test checks that a message's time keeps running while the pill's restarts when it is raised again.
  • AC-7: the manual says how the pill and messages stack — platforms/notifications.md.

How it was checked

  • cargo xtask ci --quick, cargo xtask sil and cargo test -p for the touched crates pass on this branch, up to
    date with staging (merged in, not rebased)
    • The gate passed; the branch is 18 commits behind staging on other files and merges cleanly.
  • A test that fails without this change (the stacking tests above, each seen failing first)
    • Two of them, a_pill_does_not_jump_when_the_message_in_front_of_it_leaves and changing_the_pills_position_puts_it_at_the_new_positions_own_place, pass on staging too: the old pill never moved, so they only mean something with the new stack. Each was seen failing on this branch with its part of the behaviour taken out.

Merging

  • Overlap: none found.
  • Existing edits and libraries: unchanged.
  • Shared numbers taken: none.
  • Where it came from: own design.
  • New dependencies, unsafe, build scripts, network access, spawned processes, deleted files, CI or xtask gate
    changes:
    none (see Runs on CI).

Runs on CI

Nothing beyond the touched crates' own tests. The new tests are headless and open no sockets and start no processes. No workflow, build-script, packaging, xtask or dependency changes.

Checklist

  • No new panic path in non-test code: the stack uses get_mut and total_cmp, no indexing
  • New text on screen goes through tr(); no new text on screen
  • User-visible change: the manual is updated in the same commit (docs/manual-site/; pages: platforms/notifications)

Manual: platforms/notifications.

Sources: own design.

🤖 Generated with Claude Code

- One layout function (crates/ui-egui/src/stack.rs) places the pill and the
  messages, so a pill and a message at the same position no longer draw over each
  other: the later one takes the place nearest the edge and the earlier one moves
  inward.
- The pill keeps the place it got when it appeared while it updates, and stays
  inward when a message in front of it leaves.
- ui.inspect lists the stack in a new `stack` field.
- Manual: the notifications page says how they stack.

Manual: platforms/notifications

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@emmertex emmertex left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good: one layout function (stack::place / stack::layout) for the pill and the messages, no panic paths (get_mut, total_cmp; the inward-move loop always ends because each step clears every box it overlapped), no new text on screen, and the manual, What's New and changelog entries are all there. Approving. Auto-merge is on, so it merges once the Linux gate passes.

Small things, none blocking:

  • stack::layout runs up to three times a frame (the pill, the toasts, and ui.inspect when it's called), and each run lays out every message galley again. That's cheap with three messages, but it could be worked out once per frame if the stack grows.
  • changing_the_pills_position_puts_it_at_the_new_positions_own_place compares an exact 20.0 to the edge. That's fine as a check that Down Low's own offset is used, but tying it to PILL_EDGE_OFFSET (or a tolerance) would hold up better if the offset ever changes.

@emmertex
emmertex enabled auto-merge December 4, 2026 05:02
@emmertex
emmertex merged commit 9079f01 into emmertex:staging Dec 4, 2026
3 checks passed
@clydecbrown
clydecbrown deleted the classic/feat/pill-in-stack branch December 4, 2026 05:18
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.

Stack the pill and the messages so they never overlap

2 participants