feat(desktop-shell-ball): add bubble region and pinned bubble windows#183
Conversation
|
|
||
| if (payload.action === "pin") { | ||
| detachedPinnedBubbleIdsRef.current.delete(payload.bubbleId); | ||
| void syncPinnedBubbleWindowAnchor(payload.bubbleId); |
There was a problem hiding this comment.
setBubbleItems is async, but syncPinnedBubbleWindowAnchor(payload.bubbleId) immediately reads bubbleItemsRef.current, which still contains the pre-pin snapshot. On the first pin this means bubbleItem is still unpinned, so the helper returns early and the detached window is never created until some later move/resize event happens to re-run the sync. This should be driven from the post-update state (or an effect keyed on pinned items) instead of the stale ref.
| function handleDetachDrag() { | ||
| if (followsShellBallGeometry) { | ||
| setFollowsShellBallGeometry(false); | ||
| void emitShellBallPinnedWindowDetached(pinnedBubbleId); |
There was a problem hiding this comment.
The window is marked detached on pointerdown, before any actual drag occurs. A simple click on the drag handle will emit pinnedWindowDetached, after which shell-ball moves stop re-anchoring this bubble even though the user never dragged it. That does not match the documented behavior of detaching only once the user has dragged the pinned window.
| } | ||
|
|
||
| function handleBubbleAction(payload: ShellBallBubbleActionPayload) { | ||
| setBubbleItems((currentItems) => applyShellBallBubbleAction(currentItems, payload)); |
There was a problem hiding this comment.
pin updates state and then immediately calls syncPinnedBubbleWindowAnchor(), but that helper reads bubbleItemsRef.current, which still holds the pre-update snapshot. On the first pin, the item is not yet marked pinned, so the helper returns early and no detached window is created until some later move/resize re-sync happens.
| type="button" | ||
| className="shell-ball-bubble-message__drag-handle" | ||
| aria-label="Drag pinned bubble" | ||
| onPointerDown={handleDetachDrag} |
There was a problem hiding this comment.
This marks the bubble as detached on pointerdown, not after an actual drag completes. A simple click on the drag handle permanently stops future re-anchoring, which does not match the documented detach after drag behavior.
| "windows": ["shell-ball", "shell-ball-bubble", "shell-ball-input", "shell-ball-bubble-pinned-*", "dashboard", "control-panel"], | ||
| "permissions": [ | ||
| "core:default", | ||
| "core:window:allow-create", |
There was a problem hiding this comment.
Adding core:window:allow-create to the shared default capability broadens window-creation rights for every renderer covered by this profile, not just the shell-ball surfaces. This should be scoped to a narrower shell-ball-specific capability/window set so the new pinned-window feature does not expand the app-wide trust boundary.
|
@xgopilot 先不要扩 scope。只修 pin 后 detached window 可能不会立即创建的竞态。 |
Result已按你限定的 scope 修掉 这次只改了两个点:
已提交并推送到当前 PR 分支,commit 是 Verification本地尝试执行 |
Summary
Details
BubbleMessage+ shell-ball desktop state 的包装模型Pin/Delete控件,delete 立即彻底移除,pin 后从 bubble 区消失shell-ball-bubble-pinned-<bubble_id>生成窗口标签unpin会把 bubble 按bubble.created_at,再按bubble.bubble_id回到 bubble 区原时间序位置Test Plan
pnpm --dir apps/desktop test:shell-ballpnpm --dir apps/desktop typecheckpnpm --dir apps/desktop buildpnpm --dir apps/desktop exec tauri dev