Skip to content

fix(dock): light indicators for native-window-target dock icons (#235)#245

Merged
epeicher merged 1 commit into
trunkfrom
fix/dock-indicator-native-window-icons
May 19, 2026
Merged

fix(dock): light indicators for native-window-target dock icons (#235)#245
epeicher merged 1 commit into
trunkfrom
fix/dock-indicator-native-window-icons

Conversation

@epeicher

@epeicher epeicher commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #235.

When a desktop icon registered with 'window' => '<native-id>' (no url) is promoted to the dock via itemVisibility ('dock' or 'both'), applyDockPlacement synthesized a DockItem with url: ''. The dock's active/focused indicator and hover-peek both keyed off deriveWindowId(item.url) — on an empty URL that produces a baseId that never matches the open native window's id (e.g. desktop-mode-my-wordpress). Result: the dot stayed dark and the peek card never appeared, both for fresh opens and after session restore.

CleanShot 2026-05-19 at 12 28 16@2x

Fix

  • src/dock.ts — added optional windowId?: string on DockItem; introduced resolveItemBaseId() which prefers windowId, then resolveNativeUrlRemap(item.url), then deriveWindowId(item.url). The active-state pass and the hover-peek baseId now both route through it, so they stay in lockstep.
  • src/settings/item-placement.ts — synthesized dock tiles carry windowId: icon.window || undefined so the dock has a direct key into the window manager for native-window targets.

Test plan

  • npm run lint — clean
  • npx tsc --noEmit — clean
  • npm run test:js — 1441 passing (+2 new cases in item-visibility-flow.test.ts: synth-from-window-icon carries windowId; synth-from-url-icon leaves it undefined)
  • npm run build — clean
  • Manually verified in local wordpress-develop: My WordPress (placed on dock) now lights its active dot when open + focused indicator when frontmost; same behavior after session restore.
Open WordPress Playground Preview

…cons (#235)

When a desktop icon registered with `'window' => '<native-id>'` (no
`url`) is promoted to the dock via `itemVisibility`, the synthesized
tile carried `url: ''`. The dock's indicator + hover-peek both keyed
off `deriveWindowId(item.url)`, which on an empty url produces a
baseId that never matches the open native window — so the active /
focused dot stayed dark and the peek card never appeared, both on
fresh opens and after session restore.

Fix: carry the icon's `window` field through synthesis as a new
optional `windowId` on `DockItem`, and resolve baseId via a shared
`resolveItemBaseId()` helper that prefers `windowId` before falling
back to the URL-derivation chain (remap → deriveWindowId). The
indicator path and the hover-peek now stay in lockstep through one
method.
@epeicher epeicher enabled auto-merge (squash) May 19, 2026 10:31
@github-actions

Copy link
Copy Markdown
Contributor

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@epeicher epeicher merged commit 3b12dce into trunk May 19, 2026
5 checks passed
@epeicher epeicher deleted the fix/dock-indicator-native-window-icons branch May 19, 2026 10:32
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.

When restoring a session, the restored windows are not adding the indicators in their own icons about opened/focused/minimized

1 participant