From 473d78dcbdd9c6064b77505f1f51db4d7b5a10dc Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 15 Aug 2016 18:08:21 -0700 Subject: [PATCH] Add tccutil command for assitive devices handling This commit specifically enables synergy support. --- tasks/osx.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tasks/osx.py b/tasks/osx.py index c81f9dfa..c23c52d9 100644 --- a/tasks/osx.py +++ b/tasks/osx.py @@ -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):