Skip to content

Moving a widget while editing the bar freezes it for about a second #150

Closed

Description

@M4n0x

What happens

While editing the bar in place, every move of a widget (dragging it, Move Left/Right or the arrow keys) freezes the bar until the change is saved. With a real setup (about 15 widgets from 6 packages and a theme), a move takes about 1.1 seconds on current main.

The time goes into composing the whole configuration again: includes, packages and themes are read and merged, then decoded. One composition of that setup takes about 270 ms, and a move runs it 4 times:

  1. WidgetSetup.requireSavedWidget composes the saved file to check the widget isn't a command-line one.
  2. BarStore.customizationData composes the file before the move to read the widget ids (editedDocument).
  3. It composes the file after the move to validate it.
  4. writeCustomization composes the file after the move again to show it.

Steps 1–2 and 3–4 compose the same document twice. A paused change in Settings does the same: 4 compositions to show it, then 3 more to save it.

Builds before #143, such as 0.5.0, compose 14 times per move: about 4 seconds with the same setup.

Steps to reproduce

  1. Use a configuration with several widget packages and a theme.
  2. Choose Edit Bar in Place and drag a widget to another place.

Expected

The widget lands right away.

Environment

StableBar 0.6.0-beta.20261021125338.170 (cd0d42d), macOS 26.

Evidence

Measured in an optimized build on a copy of the configuration, with scripts not started:

Time
One composition 268 ms
One move on main (median of 6) 1,123 ms

Diagnosis

  • Within one edit, the documents before and after it are composed over and over: WidgetSetup.move → ConfigurationHistory.save → BarStore.customizationData and BarStore.writeCustomization (Sources/StableBar/BarStore.swift).
  • Each composition is slow in itself. ConfigurationValue.decoded(_:) (Sources/StableBar/ConfigurationLoader.swift) converts by encoding to JSON and decoding again, and the loader does this to whole documents several times per composition. ConfigurationValue.init(from:) finds a value's type by trying object, array, string and bool with try?, so each failed attempt builds an error. Returning values that are already the requested type cut one composition from about 267 ms to about 118 ms in a quick experiment.

These are two separate fixes: compose each document once per edit, and make a composition cheaper.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Oct 21, 2026
  2. M4n0x commented on Oct 22, 2026

    @M4n0x
    CollaboratorAuthor

    Addressed by #161, which composes the configuration fewer times per edit and makes each composition cheaper, and #167, which saves after the drop animation. Reopen if a move still stalls.

  3. Seb-GRAF commented on Oct 28, 2026

    @Seb-GRAF
    Collaborator

    A move still freezes the bar, now for less time: 170–440 ms on the main thread with a large configuration (main at 2df97ea, macOS 26). Since #348, nothing moves during the freeze, but animated widgets such as the Now Playing equalizer pause, and a click or drag started then waits.

    A move still loads the configuration three times, about 140 ms each:

    • WidgetSetup.requireSavedWidget (Sources/StableBar/WidgetSetup.swift) loads the saved file to check that the widget doesn't come from the command line.
    • customizationHistory.change composes the document twice more to save it.

    Two possible fixes: skip the load in requireSavedWidget when there are no command-line changes, or compose and save off the main thread.

    Triaged by Claude Code (Claude Opus 5.5).

  4. stablebar-releases commented on Oct 29, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.9.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions