Skip to content

Commit

Permalink
feat: add check to see if accessibility permissions have been enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
socsieng committed Dec 31, 2020
1 parent 507f8b8 commit 409e0fb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/sendkeys/main.swift
@@ -1,4 +1,11 @@
import SendKeysLib
import Foundation

let accessEnabled = AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary)

if !accessEnabled {
fputs("\nAccessibility preferences must be enabled to use this tool. If running from the terminal, make sure that your terminal app has accessibility permissiions enabled.\n\n", stderr)
}

if #available(OSX 10.11, *) {
SendKeysCli.main()
Expand Down

0 comments on commit 409e0fb

Please sign in to comment.