Repository navigation
Keep approvals and Touch ID prompts focused without bringing the app forward - #156
Merged
Merged
Conversation
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.
Refs #127
Problem
Presenting an approval called
NSApp.activate(ignoringOtherApps:)so the panel could take keyboard focus. Activation brings every open Ask Key window forward, so whenever the management window was open behind other apps, each approval pulled it to the front together with the prompt. Ask Key is a menu-bar app; the prompt should appear on its own. (Present since v0.1.0, reported during the v0.2.0 acceptance.)Change
.nonactivatingPanel,becomesKeyOnlyIfNeeded = false): it becomes key and receives Return and Esc without activating the app. Its level (.modalPanel), space behavior andhidesOnDeactivate = falseare unchanged.NSApp.activatebefore presenting an approval is removed. Opening the management window from the menu bar still activates the app.AgentApprovalPanelTestsasserts the non-activating style and that the panel can become key.Touch ID prompt focus
The Touch ID prompt is shown by a separate authentication process (
--askkey-authenticate) that never activated itself, so the prompt appeared without focus and the sensor was not ready until the user clicked it (reveal plaintext, unlock, approval with authentication). The authentication process now activates itself beforeevaluatePolicy, and the app yields activation to it when the app is active.Checks
swift build: passed.swift test --filter 'AgentApprovalPanelTests|ApprovalPrompt': 9 passed, 0 failed.swift test --filter ManagementAuthentication: 24 passed, 0 failed.python3 scripts/check_hygiene.py,python3 scripts/check_module_deps.py: passed.