Add hyper key.

This commit is contained in:
2014-10-24 06:19:23 -07:00
parent f6927e0e95
commit 274aaa1972
5 changed files with 61 additions and 18 deletions

View File

@@ -13,6 +13,7 @@ def all(ctx):
brew_cask(ctx)
setup_cocoa_emacs(ctx)
enable_access_for_assistive_devices(ctx)
enable_hyper(ctx)
osx_config(ctx)
@@ -39,8 +40,7 @@ MISC = ("file-formula", "less", "openssh --with-brewed-openssl",
"perl518", "rsync", "svn", "unzip", "docker", "boot2docker", "pandoc",
"mercurial")
CASKS = ('caffeine', 'flux', 'google-chrome', 'iterm2', 'spotify', 'synergy',
'virtualbox', 'xquartz', 'slate', 'java', 'vlc', 'seil',)
'virtualbox', 'xquartz', 'slate', 'java', 'vlc', 'seil', 'karabiner')
@ctask
def osx_config(ctx):
@@ -89,20 +89,30 @@ def enable_access_for_assistive_devices(ctx):
for app in APPS_NEEDING_ASSISTIVE_DEVICE_ACCESS:
app_string = '/Applications/{0}.app'.format(app)
user_application = os.path.expanduser('~' + app_string)
if os.path.exists(user_application):
ctx.run(
'zsh -c "source ~/.zshrc && '
'enable_access_for_assistive_devices \"{0}\""'.format(
user_application
)
)
if os.path.exists(app_string):
ctx.run(
'zsh -c "source ~/.zshrc && '
'enable_access_for_assistive_devices \"{0}\""'.format(
app_string
)
enable_access_if_exists(ctx, user_application)
enable_access_if_exists(ctx, app_string)
enable_access_if_exists("/Applications/Karabiner.app/Contents/Applications/Karabiner_AXNotifier.app")
def enable_access_if_exists(ctx, app_string):
if os.path.exists(app_string):
ctx.run(
'zsh -c "source ~/.zshrc && '
'enable_access_for_assistive_devices \"{0}\""'.format(
app_string
)
)
@ctask
def enable_hyper(ctx):
source = '{0}/karabiner-hyper.xml'.format(util.RESOURCES_DIRECTORY)
destination = os.path.expanduser("~/Library/Application\\ Support/Karabiner/private.xml")
try:
ctx.run("rm {0}".format(destination))
except:
pass
ctx.run("ln -s {0} {1}".format(source, destination))
ctx.run("{0}/karabiner_config.sh".format(util.RESOURCES_DIRECTORY))
@ctask
def get_command_line_tools(ctx):