Add hyper key.

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

View File

@ -1,16 +1,19 @@
var hint = slate.op("hint", { var hint = slate.op("hint", {
"characters" : "ASDFGHJKLQWERTYUIOPCVBN" "characters" : "ASDFGHJKLQWERTYUIOPCVBN"
}); });
var grid = slate.op("grid", { var grid = slate.op("grid", {
grids: { grids: {
"1920x1080": {"width": 8, "height": 6} "1920x1080": {"width": 8, "height": 6}
} }
}); });
var hyper = ":ctrl;shift;alt;cmd";
slate.bindAll({ slate.bindAll({
"esc:cmd": hint, "esc:cmd": hint,
"space:alt": grid "space:alt": grid
}); });
slate.bind("h" + hyper, grid);
slate.configAll({ slate.configAll({
windowHintsIgnoreHiddenWindows: false, windowHintsIgnoreHiddenWindows: false,

View File

@ -5271,7 +5271,7 @@
<key>NSWindow Frame UKCrashReporter</key> <key>NSWindow Frame UKCrashReporter</key>
<string>99 294 592 584 0 0 1440 878 </string> <string>99 294 592 584 0 0 1440 878 </string>
<key>NSWindow Frame iTerm Window 0</key> <key>NSWindow Frame iTerm Window 0</key>
<string>4 476 570 401 0 0 1440 877 </string> <string>4 446 717 431 0 0 1440 877 </string>
<key>New Bookmarks</key> <key>New Bookmarks</key>
<array> <array>
<dict> <dict>
@ -6071,7 +6071,7 @@
<key>SUHasLaunchedBefore</key> <key>SUHasLaunchedBefore</key>
<true/> <true/>
<key>SULastCheckTime</key> <key>SULastCheckTime</key>
<date>2014-10-23T02:09:31Z</date> <date>2014-10-24T09:47:01Z</date>
<key>SavePasteHistory</key> <key>SavePasteHistory</key>
<false/> <false/>
<key>Show Toolbelt</key> <key>Show Toolbelt</key>
@ -6113,7 +6113,7 @@
<key>WebKitDefaultFontSize</key> <key>WebKitDefaultFontSize</key>
<integer>11</integer> <integer>11</integer>
<key>WebKitStandardFont</key> <key>WebKitStandardFont</key>
<string>Lucida Grande</string> <string>.Helvetica Neue DeskInterface</string>
<key>WindowNumber</key> <key>WindowNumber</key>
<true/> <true/>
<key>WindowStyle</key> <key>WindowStyle</key>

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<root>
<item>
<name>Remap Right Command to Hyper</name>
<appendix>OS X doesn't have a Hyper. This maps PC Application Key to Control + Shift + Option + Command.</appendix>
<identifier>imalison.right_command_to_hyper</identifier>
<autogen>
--KeyToKey--
KeyCode::COMMAND_R,
KeyCode::COMMAND_L,
ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
</autogen>
</item>
</root>

13
resources/karabiner_config.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
cli=/Applications/Karabiner.app/Contents/Library/bin/karabiner
$cli set mange.pc_app_to_hyper 1
/bin/echo -n .
$cli set repeat.initial_wait 300
/bin/echo -n .
$cli set repeat.wait 11
/bin/echo -n .
$cli set imalison.right_command_to_hyper 1
/bin/echo -n .
/bin/echo

View File

@ -13,6 +13,7 @@ def all(ctx):
brew_cask(ctx) brew_cask(ctx)
setup_cocoa_emacs(ctx) setup_cocoa_emacs(ctx)
enable_access_for_assistive_devices(ctx) enable_access_for_assistive_devices(ctx)
enable_hyper(ctx)
osx_config(ctx) osx_config(ctx)
@ -39,8 +40,7 @@ MISC = ("file-formula", "less", "openssh --with-brewed-openssl",
"perl518", "rsync", "svn", "unzip", "docker", "boot2docker", "pandoc", "perl518", "rsync", "svn", "unzip", "docker", "boot2docker", "pandoc",
"mercurial") "mercurial")
CASKS = ('caffeine', 'flux', 'google-chrome', 'iterm2', 'spotify', 'synergy', CASKS = ('caffeine', 'flux', 'google-chrome', 'iterm2', 'spotify', 'synergy',
'virtualbox', 'xquartz', 'slate', 'java', 'vlc', 'seil',) 'virtualbox', 'xquartz', 'slate', 'java', 'vlc', 'seil', 'karabiner')
@ctask @ctask
def osx_config(ctx): def osx_config(ctx):
@ -89,20 +89,30 @@ def enable_access_for_assistive_devices(ctx):
for app in APPS_NEEDING_ASSISTIVE_DEVICE_ACCESS: for app in APPS_NEEDING_ASSISTIVE_DEVICE_ACCESS:
app_string = '/Applications/{0}.app'.format(app) app_string = '/Applications/{0}.app'.format(app)
user_application = os.path.expanduser('~' + app_string) user_application = os.path.expanduser('~' + app_string)
if os.path.exists(user_application): enable_access_if_exists(ctx, user_application)
ctx.run( enable_access_if_exists(ctx, app_string)
'zsh -c "source ~/.zshrc && ' enable_access_if_exists("/Applications/Karabiner.app/Contents/Applications/Karabiner_AXNotifier.app")
'enable_access_for_assistive_devices \"{0}\""'.format(
user_application
) def enable_access_if_exists(ctx, app_string):
) if os.path.exists(app_string):
if os.path.exists(app_string): ctx.run(
ctx.run( 'zsh -c "source ~/.zshrc && '
'zsh -c "source ~/.zshrc && ' 'enable_access_for_assistive_devices \"{0}\""'.format(
'enable_access_for_assistive_devices \"{0}\""'.format( app_string
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 @ctask
def get_command_line_tools(ctx): def get_command_line_tools(ctx):