Last active
May 28, 2019 11:20
-
-
Save bradyt/55dfab5b0ee51e46e743d149c596a0ac to your computer and use it in GitHub Desktop.
karabiner-elements+hammerspoon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Recently, I have had difficulty using karabiner-elements to bind | |
caps_lock to cmd+ctrl+alt, i.e., without shift. | |
I got it working recently, but docs seem to take me there in a | |
haphazard way. I contend that the karabiner-elements | |
documentation is not completely clear on what to do. | |
If one gets stuck, you might look at | |
https://github.com/tekezo/Karabiner-Elements/issues/1225, or | |
request there to clarify further, or open similar issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ~/.config/karabiner/assets/complex_modifications/caps_lock->command+option+control.json | |
{ | |
"title": "Change caps_lock key to control+option+command.", | |
"rules": [ | |
{ | |
"description": "Change caps_lock key to control+option+command.", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "caps_lock", | |
"modifiers": { | |
"optional": [ | |
"any" | |
] | |
} | |
}, | |
"to": [ | |
{ | |
"key_code": "left_command", | |
"modifiers": [ | |
"left_control", | |
"left_option" | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ~/.hammerspoon/init.lua | |
hs.loadSpoon("WinWin") | |
mash = {"cmd", "ctrl", "alt"} | |
mash_shift = {"cmd", "ctrl", "alt", "shift"} | |
for k, v in pairs({ | |
c = "Google Chrome", | |
e = "/Applications/Emacs.app", | |
r = "Riot", | |
t = "Terminal", | |
}) | |
do | |
hs.hotkey | |
.bind(mash, k, | |
function() | |
hs.application.launchOrFocus(v) | |
end | |
) | |
end | |
for k, v in pairs({ | |
h = "left", | |
j = "down", | |
k = "up", | |
l = "right", | |
}) do | |
local f0 = function() spoon.WinWin:stepMove(v) end | |
local f1 = function() spoon.WinWin:stepResize(v) end | |
hs.hotkey.bind(mash, k, f0, nil, f0) | |
hs.hotkey.bind(mash_shift, k, f1, nil, f1) | |
end | |
hs.hotkey.bind(mash, "f", function() | |
local win = hs.window.focusedWindow() | |
win:setFullScreen(not win:isFullScreen()) | |
end) | |
hs.alert.show("Config loaded") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment