Skip to content

Commit 977ef93

Browse files
committed
Clarify input monitoring description
1 parent 93d7e52 commit 977ef93

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

Copilot for Xcode/InstructionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Text("""
2424
Text("Granting Permissions")
2525
.font(.title3)
2626
Text("""
27-
The app needs at least **Accessibility API** permissions to work. If you are using real-time suggestions, **Input Monitoring** is also needed.
27+
The app needs at least **Accessibility API** permissions to work. If you are using real-time suggestions and it doesn't work properly with **Accessibility API** permissions, try also enabling **Input Monitoring**..
2828
2929
please visit the [project's GitHub page](https://github.com/intitni/CopilotForXcode#granting-permissions-to-the-app) for instructions.
3030
""")

Core/Sources/Service/Environment.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import AppKit
22
import CopilotService
33
import Foundation
44

5-
private struct NoAccessToAccessibilityAPIError: Error, LocalizedError {
5+
struct NoAccessToAccessibilityAPIError: Error, LocalizedError {
66
var errorDescription: String? {
7-
"Permission not granted to use Accessibility API. Please turn in on in System Settings.app."
7+
"Accessibility API permission is not granted. Please enable in System Settings.app."
88
}
99
}
1010

11-
private struct FailedToFetchFileURLError: Error, LocalizedError {
11+
struct FailedToFetchFileURLError: Error, LocalizedError {
1212
var errorDescription: String? {
1313
"Failed to fetch editing file url."
1414
}

Core/Sources/Service/XPCService.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,8 @@ public class XPCService: NSObject, XPCServiceProtocol {
255255
}
256256

257257
public func setAutoSuggestion(enabled: Bool, withReply reply: @escaping (Error?) -> Void) {
258-
struct NoInputMonitoringPermission: Error, LocalizedError {
259-
var errorDescription: String? {
260-
"Permission for Input Monitoring is not granted to make real-time suggestions work. Please turn in on in System Settings.app and try again later."
261-
}
262-
}
263258
guard AXIsProcessTrusted() else {
264-
reply(NoInputMonitoringPermission())
259+
reply(NoAccessToAccessibilityAPIError())
265260
return
266261
}
267262
Task { @ServiceActor in

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Thanks to [LSP-copilot](https://github.com/TerminalFi/LSP-copilot) for showing t
1414

1515
## Permissions Required
1616

17-
- Accessibility
17+
- Accessibility API
1818
- Folder Access
19-
- Maybe Input Monitoring (Real-time Suggestions Only)
19+
- Maybe Input Monitoring
2020

2121
## Installation and Setup
2222

@@ -51,7 +51,7 @@ The first time the commands are run, the extension will ask for the necessary pe
5151

5252
Or you can grant them manually by going to the `Privacy & Security` tab in `System Settings.app`, and
5353
- Accessibility API: Click `Accessibility`, and add `Copilot for Xcode.app` to the list.
54-
- Input Monitoring: Click `Input Monitoring` and add `Copilot for Xcode.app` to the list.
54+
- Input Monitoring: (Accessibility API should cover Input Monitoring. You can try to enable it if Accessibility API is not enough for you). Click `Input Monitoring` and add `Copilot for Xcode.app` to the list.
5555

5656
### Alternative Ways to Launch the XPC Service
5757

@@ -154,7 +154,7 @@ fi
154154
155155
**Q: I turned on real-time suggestions, but nothing happens**
156156

157-
> A: Check the list in `System Settings.app > Privacy & Security > Input Monitoring`. Turn the toggle on for `Copilot for Xcode`. If it's not on the list, add it manually. After that, you may have to restart the XPC Service.
157+
> A: Please first check that the Accessibility API permission is granted, see the previous QA for details. The Accessibility API should cover Input Monitoring, but if real-time suggestions still do not work, try adding `Copilot for Xcode` to the list in `System Settings.app > Privacy & Security > Input Monitoring`. After that, you may then need to restart the XPC Service.
158158
>
159159
> If that doesn't help, try to restart the XPC Service again.
160160

0 commit comments

Comments
 (0)