Skip to content

Commit f6c6488

Browse files
committed
Update to also use title changed event to detect file change
1 parent 58bb038 commit f6c6488

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Core/Sources/SuggestionWidget/WidgetWindowsController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ private extension WidgetWindowsController {
338338
case .created, .uiElementDestroyed, .xcodeCompletionPanelChanged,
339339
.applicationDeactivated:
340340
continue
341+
case .titleChanged:
342+
continue
341343
}
342344
}
343345
}

Tool/Sources/XcodeInspector/Apps/XcodeAppInstanceInspector.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public final class XcodeAppInstanceInspector: AppInstanceInspector {
1212
}
1313

1414
public enum AXNotificationKind {
15+
case titleChanged
1516
case applicationActivated
1617
case applicationDeactivated
1718
case moved
@@ -29,6 +30,8 @@ public final class XcodeAppInstanceInspector: AppInstanceInspector {
2930

3031
public init?(rawValue: String) {
3132
switch rawValue {
33+
case kAXTitleChangedNotification:
34+
self = .titleChanged
3235
case kAXApplicationActivatedNotification:
3336
self = .applicationActivated
3437
case kAXApplicationDeactivatedNotification:
@@ -211,6 +214,7 @@ public final class XcodeAppInstanceInspector: AppInstanceInspector {
211214
let axNotificationStream = AXNotificationStream(
212215
app: runningApplication,
213216
notificationNames:
217+
kAXTitleChangedNotification,
214218
kAXApplicationActivatedNotification,
215219
kAXApplicationDeactivatedNotification,
216220
kAXMovedNotification,
@@ -233,7 +237,7 @@ public final class XcodeAppInstanceInspector: AppInstanceInspector {
233237
guard let self else { return }
234238
try Task.checkCancellation()
235239
await Task.yield()
236-
240+
237241
guard let event = AXNotificationKind(rawValue: notification.name) else {
238242
continue
239243
}

Tool/Sources/XcodeInspector/XcodeWindowInspector.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public final class WorkspaceXcodeWindowInspector: XcodeWindowInspector {
4747

4848
group.addTask { [weak self] in
4949
for await notification in await axNotifications.notifications() {
50-
guard notification.kind == .focusedUIElementChanged else { continue }
50+
guard notification.kind == .focusedUIElementChanged
51+
|| notification.kind == .titleChanged
52+
else { continue }
5153
guard let self else { return }
5254
try Task.checkCancellation()
5355
await Task.yield()

0 commit comments

Comments
 (0)