Add tccutil command for assitive devices handling

This commit specifically enables synergy support.
This commit is contained in:
Ivan Malison 2016-08-15 18:08:21 -07:00
parent 2f6e2e23c9
commit 473d78dcbd
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -76,6 +76,7 @@ APPS_NEEDING_ASSISTIVE_DEVICE_ACCESS = ('Slate', 'Synergy', 'iTerm')
@ctask
def access_for_assistive_devices(ctx):
# TODO: refactor to use tccutil.py
for app in APPS_NEEDING_ASSISTIVE_DEVICE_ACCESS:
app_string = '/Applications/{0}.app'.format(app)
user_application = os.path.expanduser('~' + app_string)
@ -91,6 +92,25 @@ def access_for_assistive_devices(ctx):
"Karabiner_AXNotifier.app"
)
SYNERGY_BINARIES_PATH = '/Applications/Synergy.app/Contents/MacOS/'
SCRIPTS_NEEDING_ASSISTIVE_DEVICE_ACCESS = [
os.path.join(SYNERGY_BINARIES_PATH, 'synergyc'),
os.path.join(SYNERGY_BINARIES_PATH, 'synergys'),
"org.gnu.Emacs",
"com.googlecode.iterm2",
]
@ctask
def tccutil(ctx):
for script in SCRIPTS_NEEDING_ASSISTIVE_DEVICE_ACCESS:
ctx.run(
'sudo tccutil -i "{}"'.format(script)
)
ctx.run(
'sudo tccutil -e "{}"'.format(script)
)
def access_if_exists(ctx, app_string):
if os.path.exists(app_string):