Skip to content

Instantly share code, notes, and snippets.

@s4kr4
Created January 15, 2017 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s4kr4/f9b03fc8b3bfce79a797aebd593883f6 to your computer and use it in GitHub Desktop.
Save s4kr4/f9b03fc8b3bfce79a797aebd593883f6 to your computer and use it in GitHub Desktop.
hammerspoon
local prefix = {"cmd", "ctrl"}
hs.hotkey.bind(prefix, "Up", 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)
hs.hotkey.bind(prefix, "Left", 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(prefix, "Right", 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("alt", "tab", function()
hs.window.switcher.nextWindow()
end)
hs.hotkey.bind({"alt", "shift"}, "tab", function()
hs.window.switcher.previousWindow()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment