Repository navigation
fix: apply host app rules to nested UI apps like Docker Desktop (#25) - #26
Merged
Merged
Conversation
…e 25 regression tests, docs Docker Desktop's windows belong to com.electron.dockerdesktop, nested inside the faceless Docker.app agent (com.docker.docker). Rules written for com.docker.docker never matched, so SmartClose still quit Docker Desktop. - HostAppResolver finds the enclosing app bundle and treats it as a host only when it is faceless (LSUIElement / LSBackgroundOnly); regular apps such as Xcode do not leak rules onto bundled apps like Simulator. Results are cached per bundle path. - Exclusions (hard, allow list, ignore list) match either id; per-app rules and Cmd+W overrides prefer the window owner's own rule and fall back to the host's. - Red close button and Cmd+W paths both pass the host; diagnostics name the host when its rule decided the outcome. Fixes #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (#25)
Ignore-list entries and per-app rules for Docker Desktop (
com.docker.docker) had no effect, so SmartClose still quit Docker Desktop.I inspected the Docker Desktop 4.98.0 arm64 DMG to find the cause:
Docker.appcom.docker.dockerLSUIElement=true) with no windowsDocker.app/Contents/MacOS/Docker Desktop.appcom.electron.dockerdesktopSmartClose resolves rules against the window owner's bundle ID, so a rule for
com.docker.dockernever matched.Fix
HostAppResolverfinds the app bundle that encloses the window owner. It treats that bundle as a host only when it is faceless (LSUIElementorLSBackgroundOnly). Regular apps that bundle other apps, such as Xcode with Simulator and Instruments, are not hosts, so their rules do not leak onto those apps. Results are cached per bundle path, and the lookup runs only after a close button is detected.Existing setups behave the same unless a rule names a faceless host app.
Verification
xcodebuild test -only-testing:SmartCloseTestson macOS 27.0.1 / Xcode 27.0: 84 tests, 0 failures, including 16 new tests (Docker ignore/per-app/allow list, own-rule precedence, wildcard, Cmd+W, Xcode-style regular host ignored, caching).Bundle(url:)check against a fake bundle tree with Docker's layout: host resolved tocom.docker.docker. Simulator inside a regular Xcode.app and top-level Safari both resolved to nil.CI: local checks PASS.
Fixes #25