Remove aggressive accessibility permission blocks

This commit is contained in:
Beingpax 2025-06-22 23:41:32 +05:45
parent a0a1257e3b
commit 41af16597b
3 changed files with 12 additions and 14 deletions

View File

@ -5,9 +5,6 @@ class CursorPaster {
private static let pasteCompletionDelay: TimeInterval = 0.3
static func pasteAtCursor(_ text: String, shouldPreserveClipboard: Bool = true) {
guard AXIsProcessTrusted() else {
return
}
let pasteboard = NSPasteboard.general
@ -45,6 +42,10 @@ class CursorPaster {
}
private static func pasteUsingAppleScript() -> Bool {
guard AXIsProcessTrusted() else {
return false
}
let script = """
tell application "System Events"
keystroke "v" using command down
@ -60,6 +61,10 @@ class CursorPaster {
}
private static func pasteUsingCommandV() {
guard AXIsProcessTrusted() else {
return
}
let source = CGEventSource(stateID: .hidSystemState)
let cmdDown = CGEvent(keyboardEventSource: source, virtualKey: 0x37, keyDown: true)

View File

@ -367,10 +367,8 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
text += " "
SoundManager.shared.playStopSound()
if AXIsProcessTrusted() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: !self.isAutoCopyEnabled)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: !self.isAutoCopyEnabled)
}
try? FileManager.default.removeItem(at: url)
@ -464,10 +462,8 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
)
let textToPaste = newTranscription.enhancedText ?? newTranscription.text
if AXIsProcessTrusted() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
CursorPaster.pasteAtCursor(textToPaste + " ", shouldPreserveClipboard: !self.isAutoCopyEnabled)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
CursorPaster.pasteAtCursor(textToPaste + " ", shouldPreserveClipboard: !self.isAutoCopyEnabled)
}
}

File diff suppressed because one or more lines are too long