Last active
August 29, 2015 14:12
-
-
Save tanguyantoine/5b01c5c4cab7d8f9d741 to your computer and use it in GitHub Desktop.
Hammerspoon Config
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
-------- position ----------- | |
--[[ | |
& - " | |
- - - | |
è - ç | |
]]-- | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "&", function() | |
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 / 3 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, 'é', function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.w - f.w | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, '"', function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.x | |
f.y = max.h - f.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "'", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.w - f.w | |
f.y = max.h - f.h | |
win:setFrame(f) | |
win:moveToScreen(screen) | |
end) | |
------ full screen ----- | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "F", function() | |
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) | |
-------- Movements ----------- | |
--[[ | |
- Y - | |
G - J | |
- B - | |
]]-- | |
step = 100 | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "G", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x - step | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "J", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x + step | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Y", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.y = f.y - step | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "B", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.y = f.y + step | |
win:setFrame(f, 0) | |
end) | |
--[[ | |
diagonales | |
T-U | |
--- | |
V-N | |
]]-- | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "T", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x - step | |
f.y = f.y - step | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "U", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x + step | |
f.y = f.y - step | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "V", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x - step | |
f.y = f.y + step | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "N", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x + step | |
f.y = f.y + step | |
win:setFrame(f, 0) | |
end) | |
--- resize ---- | |
stepSize = 100 | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.w = f.w - stepSize | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Right", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.w = f.w + stepSize | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Up", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.h = f.h - stepSize | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Down", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.h = f.h + stepSize | |
win:setFrame(f) | |
end) | |
-- change monitors -- | |
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "Left", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
win:moveToScreen(screen:previous()) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "Right", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
win:moveToScreen(screen:next()) | |
end) | |
-- quich move -- | |
hs.hotkey.bind({"cmd", "alt" }, "&", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h / 2 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt" }, "é", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.w / 2 | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h / 2 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt" }, '"', function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.x | |
f.y = max.h / 2 | |
f.w = max.w / 2 | |
f.h = max.h / 2 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt" }, "'", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.w / 2 | |
f.y = max.h / 2 | |
f.w = max.w / 2 | |
f.h = max.h / 2 | |
win:setFrame(f) | |
end) | |
-- top left right bottom | |
hs.hotkey.bind({"cmd", "alt" }, "Right", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.w / 2 | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt" }, "Left", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt" }, "Up", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w | |
f.h = max.h / 2 | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt" }, "Down", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:fullFrame() | |
f.x = max.x | |
f.y = max.h / 2 | |
f.w = max.w | |
f.h = max.h / 2 | |
win:setFrame(f, 0) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function() | |
hs.reload() | |
end) | |
hs.alert.show("Config loaded") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment