Repository navigation
Conversation
get_app_state always reads the app's focused window, and nothing lets a caller see or pick another one (iFurySt#83, finding 1). list_windows lists a running app's windows as accessibility reports them on the current Space, with the CGWindowID that query already takes as window_id, plus title, subrole, focused, minimized and bounds. It never launches, activates or raises the app. get_app_state takes the same window_id and roots the snapshot at that window through the existing _AXUIElementGetWindow binding: no activation, no raise, no title fallback to another window. Follow-up reads (action read-back, sky_key read-back) stay on that window until get_app_state is called without window_id, or fall back to the key window once it closes. Focus held in another window is not reported for a bound window, so type_text refuses instead of writing into the other window. Linux and Windows do not expose list_windows (unsupportedTool, like query and select_text) and reject window_id on get_app_state.
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.
What
list_windows {app}: lists a running app's windows as accessibility reports them on the current Space:window_id(the CGWindowIDqueryalready takes),title,subrole,focused,minimized,bounds(screen points). It never launches, activates or raises the app.get_app_statetakeswindow_id: the tree, screenshot, focus and selection come from that window, which is not activated or raised. Later actions and their read-back stay on it untilget_app_stateis called withoutwindow_id; if the window closes, the read-back returns the key window. An unknown id is an error.type_textrefuses instead of typing into the other window;key_method: "sky_key"types into the bound window.app.listWindows(),app.getAXState({ windowId }).list_windowsis not exposed (unsupportedTool, likequery/select_text), andget_app_staterejectswindow_id.Why
Relates to #83, finding 1.
get_app_statealways reads the app's focused window, and nothing lets a caller see or pick another one;queryalready accepted awindow_id, but nothing returned one. The binding has to cover action read-back, otherwise a click's result switches back to the focused window, replaces the cached snapshot, and the next index lands in the other window again. Window-scoped indexes (the larger API question in #83) are not part of this.Verification
swift test: 383 tests, 7 skipped, 0 failures. New tests: tool list and schema, invalidwindow_idvalues, missingapp, an absent app returningappNotFoundwithout being launched,list_windowsfailing on a revoked lease before resolving the app.go vetpasses for both.window_id=B gives B; clicking B's button reads back B with the change;type_textrefuses while A's field holds focus;sky_keytypes into B; an unknown id errors; the front app is unchanged.Notes
press_keywith the default method still goes to the app's key window when another window is bound (documented; onlytype_textrefuses).windowElement(for:)(to find sheets); the two compose, and whichever merges second needs a small rebase.