Skip to content

feat: draw every widget through layout blocks, with transitions and temporary output - #52

Merged
M4n0x merged 10 commits into
mainfrom
feat/block-widgets
Oct 17, 2026
Merged

M4n0x merged 10 commits into
mainfrom
feat/block-widgets

Conversation

@M4n0x

@M4n0x M4n0x commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Problem

Fixes #16.

Widgets were drawn two ways. Built-in types went through a switch and label(). Widgets with a layout, overlays and popups went through blocks. A widget's text was also worked out in three places. So transitions, temporary output and block options such as scrollSpeed would each have needed building twice, and changed text or a widget that hides snapped into place.

Changes

  • One label per widget kind (WidgetLabel.swift). It holds the text, icon and fields each widget shows. The bar, the More widgets menu and Diagnostics all read it, and clock layouts get the time.
  • Default layouts. These come from two refactor commits, a perf and two test commits.
    • Every built-in widget except workspaces and spacers draws through blocks, as a row of its icon and text.
    • Pixel tests compare each default layout with a copy of the previous drawing, at a tolerance of 1/255, in every hover and open pair. The cases include a real app icon and icon-only widgets.
    • Blocks are built without type erasure, and the hidden measuring copy no longer animates.
  • Transitions. Widgets and text, field and symbol blocks accept transition: fade, roll, numeric or none. Customize's widget editor has a Transition picker.
  • In and out. A widget with a transition fades or rolls in and out when its output's hidden changes, and its neighbours slide into place.
  • Temporary output. "temporary": { "fields": {…}, "duration": … } shows fields over the output's own for a set time. Sending the same temporary again after it ran out shows it again. The modular example's volume widget uses it.
  • Block options on built-in widgets. Through a layout, built-in widgets can now use block options, such as an app name that scrolls with scrollSpeed.
  • README. It covers the default layout, transitions, temporary output and the label in Diagnostics.

Testing

  • Suite: swift test passes 205 tests at the branch tip, 30 of them new. Every commit builds with its tests and passes the suite.

  • Pixel tests: default layouts match the reference drawing at 1/255 for text, clock, script, provider and active-app widgets. That includes graphs and icon-only widgets, in every hover and open pair. GitHub's runners may antialias differently; the first CI run shows whether the tolerance holds there.

  • In a running bar, with a scratch configuration:

    • fade, roll and numeric transitions, where numeric rolls only the digits that changed;
    • a widget that hides and shows, with its neighbours sliding;
    • temporary output that runs out on time, isn't extended by a repeat while it shows, shows again when repeated after it ran out, and restarts for a different value.

    A recording follows in a comment.

  • Not checked:

    • neighbours sliding when a member of a group hides;
    • nested transitions when a whole rolling unit is removed;
    • Instruments.

Merging

A merge commit, so each commit reaches the changelog: four feat and one perf.

The pull request for #17 builds on this branch.

Claude Opus 5.5 via Claude Code

@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner October 17, 2026 08:12
@M4n0x
M4n0x added this pull request to stack #54 October 17, 2026 08:24
@M4n0x
M4n0x merged commit 7d6d743 into main Oct 17, 2026
4 checks passed
@M4n0x
M4n0x deleted the feat/block-widgets branch October 17, 2026 08:24
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Draw every widget through layout blocks

1 participant