Last active
April 20, 2022 22:02
-
-
Save fabriziogiordano/66df41ca5412044edf7d4ef3f9ae347e to your computer and use it in GitHub Desktop.
Karabinier
This file contains 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
{ | |
"title": "Personal", | |
"rules": [ | |
{ | |
"description": "Text Shortcut", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "s", | |
"modifiers": { "mandatory": ["right_command"], "optional": ["any"] } | |
}, | |
"to": [ | |
{ "key_code": "s", "modifiers": ["shift"] }, | |
{ "key_code": "e" } | |
], | |
"type": "basic" | |
}, | |
{ | |
"from": { | |
"key_code": "i", | |
"modifiers": { "mandatory": ["right_command"], "optional": ["any"] } | |
}, | |
"to": [ | |
{ "key_code": "i", "modifiers": ["shift"] }, | |
{ "key_code": "l" } | |
], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "CapsLock to Hyper for Hammerspoon", | |
"manipulators": [ | |
{ | |
"from": { "key_code": "caps_lock", "modifiers": { "optional": ["any"] } }, | |
"to": [ | |
{ | |
"key_code": "left_shift", | |
"modifiers": ["command", "control", "option"] | |
} | |
], | |
"to_if_alone": [{ "key_code": "tab", "modifiers": ["command"] }], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "FN Keys for Hammerspoon workflows", | |
"manipulators": [ | |
{ | |
"description": "Hammerspoon - key combination", | |
"from": { | |
"key_code": "q", | |
"modifiers": { "mandatory": ["right_command", "right_option"], "optional": ["any"] } | |
}, | |
"to": [{ "key_code": "f10", "modifiers": ["shift"] }], | |
"type": "basic" | |
}, | |
{ | |
"description": "Hammerspoon - key combination", | |
"from": { | |
"key_code": "w", | |
"modifiers": { "mandatory": ["right_command", "right_option"], "optional": ["any"] } | |
}, | |
"to": [{ "key_code": "f11", "modifiers": ["shift"] }], | |
"type": "basic" | |
}, | |
{ | |
"description": "Hammerspoon - key combination", | |
"from": { | |
"key_code": "e", | |
"modifiers": { "mandatory": ["right_command", "right_option"], "optional": ["any"] } | |
}, | |
"to": [{ "key_code": "f12", "modifiers": ["shift"] }], | |
"type": "basic" | |
} | |
] | |
} | |
] | |
} |
This file contains 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
HOTKEY = hs.hotkey | |
HYPER = { "shift", "command", "control", "option" } -- Karabinier maps this as: Caps_Lock |
This file contains 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
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function() | |
hs.alert.show( | |
"Hello World!", | |
{ | |
textFont= "Comic Sans MS", | |
textSize=72, | |
fadeOutDuration=1 | |
} | |
) | |
end) | |
-- Magnet replacement bindings | |
hs.hotkey.bind({"ctrl", "alt"}, "left", function() | |
-- size focused window to left half of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "a", function() | |
-- size focused window to left third of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w / 3 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "s", function() | |
-- size focused window to middle third of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x + (max.w / 3) | |
f.y = max.y | |
f.w = max.w / 3 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "d", function() | |
-- size focused window to right third of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x + (max.w / 3 * 2) | |
f.y = max.y | |
f.w = max.w / 3 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "right", function() | |
-- size focused window to right half of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x + (max.w / 2) | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "return", function() | |
-- size focused window to size of desktop | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "up", function() | |
-- size focused window to top half of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w | |
f.h = max.h / 2 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"ctrl", "alt"}, "down", function() | |
-- size focused window to bottom half of display | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x | |
f.y = max.y + (max.h / 2) | |
f.w = max.w | |
f.h = max.h / 2 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "F", function() | |
-- toggle the focused window to full screen (workspace) | |
local win = hs.window.focusedWindow() | |
win:setFullScreen(not win:isFullScreen()) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "right", function() | |
-- move the focused window one display to the right | |
local win = hs.window.focusedWindow() | |
win:moveOneScreenEast() | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "left", function() | |
-- move the focused window one display to the left | |
local win = hs.window.focusedWindow() | |
win:moveOneScreenWest() | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function() | |
RoundedCorners = hs.loadSpoon('RoundedCorners') | |
RoundedCorners.radius = 20 | |
RoundedCorners:start() | |
hs.alert.show("Oooooooooh, so ROUND!") | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment