Remove aggressive accessibility permission blocks
This commit is contained in:
parent
a0a1257e3b
commit
41af16597b
@ -5,9 +5,6 @@ class CursorPaster {
|
|||||||
private static let pasteCompletionDelay: TimeInterval = 0.3
|
private static let pasteCompletionDelay: TimeInterval = 0.3
|
||||||
|
|
||||||
static func pasteAtCursor(_ text: String, shouldPreserveClipboard: Bool = true) {
|
static func pasteAtCursor(_ text: String, shouldPreserveClipboard: Bool = true) {
|
||||||
guard AXIsProcessTrusted() else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let pasteboard = NSPasteboard.general
|
let pasteboard = NSPasteboard.general
|
||||||
|
|
||||||
@ -45,6 +42,10 @@ class CursorPaster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func pasteUsingAppleScript() -> Bool {
|
private static func pasteUsingAppleScript() -> Bool {
|
||||||
|
guard AXIsProcessTrusted() else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
let script = """
|
let script = """
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
keystroke "v" using command down
|
keystroke "v" using command down
|
||||||
@ -60,6 +61,10 @@ class CursorPaster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func pasteUsingCommandV() {
|
private static func pasteUsingCommandV() {
|
||||||
|
guard AXIsProcessTrusted() else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let source = CGEventSource(stateID: .hidSystemState)
|
let source = CGEventSource(stateID: .hidSystemState)
|
||||||
|
|
||||||
let cmdDown = CGEvent(keyboardEventSource: source, virtualKey: 0x37, keyDown: true)
|
let cmdDown = CGEvent(keyboardEventSource: source, virtualKey: 0x37, keyDown: true)
|
||||||
|
|||||||
@ -367,10 +367,8 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
|
|||||||
text += " "
|
text += " "
|
||||||
|
|
||||||
SoundManager.shared.playStopSound()
|
SoundManager.shared.playStopSound()
|
||||||
if AXIsProcessTrusted() {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: !self.isAutoCopyEnabled)
|
||||||
CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: !self.isAutoCopyEnabled)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
try? FileManager.default.removeItem(at: url)
|
try? FileManager.default.removeItem(at: url)
|
||||||
|
|
||||||
@ -464,10 +462,8 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let textToPaste = newTranscription.enhancedText ?? newTranscription.text
|
let textToPaste = newTranscription.enhancedText ?? newTranscription.text
|
||||||
if AXIsProcessTrusted() {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
CursorPaster.pasteAtCursor(textToPaste + " ", shouldPreserveClipboard: !self.isAutoCopyEnabled)
|
||||||
CursorPaster.pasteAtCursor(textToPaste + " ", shouldPreserveClipboard: !self.isAutoCopyEnabled)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user