You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Focus windows on hover never moves focus away from VS Code #1471
changed the title [-]Focus windows on hover doesn't move focus from VS Code to Warp[/-][+]Focus windows on hover never moves focus away from VS Code[/+]on Oct 21, 2026
More testing: with Warp, ChatGPT, Safari and VS Code (1.139.1) on the same screen, hover focus works between Warp, ChatGPT and Safari in every direction. Once VS Code has focus, hovering any other window leaves focus in VS Code (Cmd+V keeps pasting into VS Code). So the problem is leaving VS Code, not entering Warp. I've updated the title.
Cause
While VS Code is frontmost, the system-wide kAXFocusedApplicationAttribute query returns kAXErrorNoValue (-25212). With Safari, ChatGPT or Warp frontmost, the same query returns the right app. So HoverWindowQuery.currentFocus() returns nil, and FocusFollowsMouseController.poll() calls state.suspend() without ever attempting the focus change.
Things I ruled out:
WindowFocus.focus() works from VS Code: running the same SkyLight sequence (_SLPSSetFrontProcessWithOptions + the two key records) outside LinearMouse with VS Code frontmost moved focus to Safari, and VS Code did not take it back within 2 s.
VS Code's window passes the other checks: the per-app queries return a focused window that is AXWindow/AXStandardWindow, not modal, with no sheets; no menu bar item is selected; all calls finish well under the 50 ms timeout.
Possible fix
Fall back to the frontmost application when the system-wide query returns nothing:
func currentFocus() -> Focus? {
- guard let app = element(kAXFocusedApplicationAttribute, on: system) else {+ guard let app = focusedApplication() else {
return nil
}
@@
+ /// Some Electron apps (e.g. VS Code) leave the system-wide focused application+ /// unanswered (kAXErrorNoValue) while frontmost. Fall back to the frontmost+ /// application, or hover focus could never leave them.+ private func focusedApplication() -> AXUIElement? {+ if let app = element(kAXFocusedApplicationAttribute, on: system) {+ return app+ }+ guard let pid = NSWorkspace.shared.frontmostApplication?.processIdentifier else {+ return nil+ }+ return AXUIElementCreateApplication(pid)+ }
I compiled HoverWindowQuery.swift (original and patched) with WindowFocus.swift into a small test binary and called currentFocus() from a background queue, as poll() does, three times each:
Frontmost
Original
Patched
VS Code
nil
VS Code, its focused window
Safari
Safari, its focused window
Safari, its focused window
Not verified: I couldn't build LinearMouse itself (no Xcode here), so the full app with this change hasn't been tested end to end and hasn't been run through swiftformat/swiftlint. I'm also not sure reading NSWorkspace.frontmostApplication from the hover worker queue is fine, or whether you'd prefer a SkyLight call here (e.g. _SLPSGetFrontProcess) instead.
Activity
[-]Focus windows on hover doesn't move focus from VS Code to Warp[/-][+]Focus windows on hover never moves focus away from VS Code[/+]EduRomoGO commentedon Oct 21, 2026
More testing: with Warp, ChatGPT, Safari and VS Code (1.139.1) on the same screen, hover focus works between Warp, ChatGPT and Safari in every direction. Once VS Code has focus, hovering any other window leaves focus in VS Code (Cmd+V keeps pasting into VS Code). So the problem is leaving VS Code, not entering Warp. I've updated the title.
Cause
While VS Code is frontmost, the system-wide
kAXFocusedApplicationAttributequery returnskAXErrorNoValue(-25212). With Safari, ChatGPT or Warp frontmost, the same query returns the right app. SoHoverWindowQuery.currentFocus()returnsnil, andFocusFollowsMouseController.poll()callsstate.suspend()without ever attempting the focus change.Things I ruled out:
WindowFocus.focus()works from VS Code: running the same SkyLight sequence (_SLPSSetFrontProcessWithOptions+ the two key records) outside LinearMouse with VS Code frontmost moved focus to Safari, and VS Code did not take it back within 2 s.AXWindow/AXStandardWindow, not modal, with no sheets; no menu bar item is selected; all calls finish well under the 50 ms timeout.Possible fix
Fall back to the frontmost application when the system-wide query returns nothing:
func currentFocus() -> Focus? { - guard let app = element(kAXFocusedApplicationAttribute, on: system) else { + guard let app = focusedApplication() else { return nil } @@ + /// Some Electron apps (e.g. VS Code) leave the system-wide focused application + /// unanswered (kAXErrorNoValue) while frontmost. Fall back to the frontmost + /// application, or hover focus could never leave them. + private func focusedApplication() -> AXUIElement? { + if let app = element(kAXFocusedApplicationAttribute, on: system) { + return app + } + guard let pid = NSWorkspace.shared.frontmostApplication?.processIdentifier else { + return nil + } + return AXUIElementCreateApplication(pid) + }I compiled
HoverWindowQuery.swift(original and patched) withWindowFocus.swiftinto a small test binary and calledcurrentFocus()from a background queue, aspoll()does, three times each:nilNot verified: I couldn't build LinearMouse itself (no Xcode here), so the full app with this change hasn't been tested end to end and hasn't been run through swiftformat/swiftlint. I'm also not sure reading
NSWorkspace.frontmostApplicationfrom the hover worker queue is fine, or whether you'd prefer a SkyLight call here (e.g._SLPSGetFrontProcess) instead.