Skip to content

Fix Dock scan when items disappear during enumeration - #63

Open
Warren2068 wants to merge 2 commits into
hatimhtm:mainfrom
Warren2068:fix/dock-scan-transient-items
Open

Warren2068 wants to merge 2 commits into
hatimhtm:mainfrom
Warren2068:fix/dock-scan-transient-items

Conversation

@Warren2068

@Warren2068 Warren2068 commented Sep 27, 2026 •

Copy link
Copy Markdown

Problem

When a Dock item disappears during enumeration (for example, after an app is removed or unpinned), System Events can return error -1728 for that item. The current scan treats this as a failure of the entire list and clears dockItems, leaving click-to-minimize enabled but unresponsive.

Change

  • Skip Dock items that vanish during the AppleScript scan while retaining valid items.
  • Retry a failed or empty full scan up to three times, one second apart.
  • Update the cached list on the main queue and avoid iterating a zero-length result.

Validation

  • Xcode 27.0 Release build on macOS 27.2: passed (CODE_SIGNING_ALLOWED=NO).
  • Embedded AppleScript syntax check with osacompile: passed.
  • git diff --check: passed.
  • Installed an ad hoc signed build locally, regranted Accessibility access, and confirmed the event tap installs without errors.
  • The user confirmed that clicking the Dock icon of the frontmost app minimizes its window. The disappearing-item race has not been reproduced after this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant