fix(macos): move Launch at Login operations off the UI thread - #104
Merged
Merged
Conversation
Collaborator
|
Thanks, merged. The single-worker ownership, bounded channels, pending-action coalescing, and nonblocking close behavior look good. After building the command SDK prerequisite, I verified all 486 Rust tests and all 12 keyboard-layout scenarios, plus strict all-target/all-feature Clippy, formatting, and whitespace checks. I did not repeat the native signed-app login-item smoke test. |
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.
Why
Hex asks macOS for the Launch at Login status every 500 ms. These calls currently run on the same thread that handles the UI, so it has to wait for macOS to respond before continuing.
I moved this work to a separate thread so the UI does not need to wait for those calls.
What Changes
As suggested in #89, this uses one long-lived worker with a request channel instead of creating a new thread for each request.
The worker handles status checks, enabling/disabling Launch at Login, and opening Login Items settings. If it is busy, repeated checks are skipped and only the latest pending user action is kept.
macOS still owns the setting. Hex reads the response and updates the toggle; it does not save another copy of the setting.
Closing Settings stops the worker. Opening it again creates a new one.
Verification
The manual checks used an ad-hoc signed temporary app. Developer ID signed distribution behavior and native approval/error transitions remain unverified.