Skip to content

Instantly share code, notes, and snippets.

@teknofire
Created August 10, 2017 18:42
Show Gist options
  • Save teknofire/eca97e4d03960ad3e2d231db88ef6f46 to your computer and use it in GitHub Desktop.
Save teknofire/eca97e4d03960ad3e2d231db88ef6f46 to your computer and use it in GitHub Desktop.
hammerspoon config
hs.hotkey.bind({"cmd", "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 / 2
f.h = max.h
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "]", function()
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({"cmd", "ctrl"}, "j", 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 + (max.h / 2)
f.w = max.w
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "k", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x / 2
f.y = max.y
f.w = max.w
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "o", function()
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 / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "i", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = 0
f.y = max.y
f.w = max.w / 2
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "u", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = 0
f.y = max.y + (max.h / 2)
f.w = max.w / 2
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "p", function()
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 + (max.h / 2)
f.w = max.w / 2
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "ctrl"}, "m", 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment