Skip to content

fix: accept workspace icon drops on every workspace - #296

Merged
M4n0x merged 1 commit into
mainfrom
fix/workspace-drop-window-destination
Oct 23, 2026
Merged

M4n0x merged 1 commit into
mainfrom
fix/workspace-drop-window-destination

Conversation

@M4n0x

@M4n0x M4n0x commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

Dropping a workspace icon on another workspace still does nothing in 0.8.0-beta.20261023121631.363, which includes #283. The drag starts, but the destination isn't outlined, and on release the icon slides back without moving any window. Fixes #280.

Changes

  • Why fix: move windows when workspace icons are dropped #283 wasn't enough. AppKit picks a drop destination with its own lookup, -[NSView _hitTest:dragTypes:]. That lookup walks view frames and never calls hitTest(_:). SwiftUI hosts each workspace cell's NSViewRepresentable in a container view whose frame need not contain the cell, so AppKit couldn't reach most of the registered cells. On a five-workspace bar it reached two cells and part of a third, with or without glass. A drag trace on a scratch bar matched: AppKit entered the workspace where the drag began, exited at its edge and never entered another, and no drop callback ran. SwiftUI's hit-testing, which clicks use, finds every cell, and that's what the tests in fix: move windows when workspace icons are dropped #283 routed through.
  • The bar window takes the drop. BarPanel registers the workspace drag type and forwards each drag update to the cell under the pointer, found with hitTest(_:) as clicks are. The cells keep their accept and move logic but no longer register for the type. Each bar window is its own destination, so drops onto another display's bar still work.
  • Tests. The offscreen drop test drives the panel's destination callbacks at the cells' locations: the label's edge, the middle, outside every cell, and an exit. It also checks that no view inside the bar registers the type.

Testing

  • Live, on a scratch bar with AeroSpace, app icons, glass widgets and two displays: dropped icons on other workspaces, and the destination was outlined and the window moved there, per AeroSpace's window list. Before this change, the same drags were rejected.
  • AppKit's lookup was called directly from a throwaway test, not committed: it found no destination over most workspace cells before this change.
  • swift test on this branch plus refactor: move a bar tile's hover handling out of its body so Xcode 26.3 compiles it #295, which main needs to compile with Xcode 26.3: 294 XCTest and 449 Swift Testing tests pass. CI builds this branch on main alone.
  • Cost: each drag update hit-tests the bar once, about 0.43 ms on a 17-widget bar in a debug build, and hovering the same workspace doesn't redraw the widget. Nothing runs outside a workspace drag.
  • Nothing looks different from fix: move windows when workspace icons are dropped #283, so there are no new screenshots: the outline and the move now happen on every workspace.
  • git diff --check and commitlint pass.

Merging

A merge commit or rebase merge, which keeps the one commit. As a fix, it makes a patch release.

Claude Opus 5.5 via Claude Code

AppKit looks for a drop destination by walking view frames, and SwiftUI hosts each
workspace cell in a container whose frame need not contain it. Most cells were out of
AppKit's reach, so a drag entered the workspace it started from and no other, and
dropping an icon did nothing.

The bar window now registers the drag type and forwards each update to the cell under
the pointer, found with the same hit-testing that clicks use. Cells no longer register
for the type themselves.

Closes #280
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner October 23, 2026 14:44
@M4n0x
M4n0x merged commit 3801410 into main Oct 23, 2026
19 of 21 checks passed
@M4n0x
M4n0x deleted the fix/workspace-drop-window-destination branch October 23, 2026 15:10
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.8.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.

Dropping workspace icons does not move their windows

1 participant