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", {
"characters" : "ASDFGHJKLQWERTYUIOPCVBN"
});
var grid = slate.op("grid", {
grids: {
"1920x1080": {"width": 8, "height": 6}
}
});
var hyper = ":ctrl;shift;alt;cmd";
slate.bindAll({
"esc:cmd": hint,
"space:alt": grid
});
slate.bind("h" + hyper, grid);
slate.configAll({
windowHintsIgnoreHiddenWindows: false,

View File

@ -5271,7 +5271,7 @@
<key>NSWindow Frame UKCrashReporter</key>
<string>99 294 592 584 0 0 1440 878 </string>
<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>
<array>
<dict>
@ -6071,7 +6071,7 @@
<key>SUHasLaunchedBefore</key>
<true/>
<key>SULastCheckTime</key>
<date>2014-10-23T02:09:31Z</date>
<date>2014-10-24T09:47:01Z</date>
<key>SavePasteHistory</key>
<false/>
<key>Show Toolbelt</key>
@ -6113,7 +6113,7 @@
<key>WebKitDefaultFontSize</key>
<integer>11</integer>
<key>WebKitStandardFont</key>
<string>Lucida Grande</string>
<string>.Helvetica Neue DeskInterface</string>
<key>WindowNumber</key>
<true/>
<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)
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):