Skip to content

Instantly share code, notes, and snippets.

@RickCogley
Created February 24, 2019 12:14
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 RickCogley/221e99d5b8ccf97d2304910d45a587d0 to your computer and use it in GitHub Desktop.
Save RickCogley/221e99d5b8ccf97d2304910d45a587d0 to your computer and use it in GitHub Desktop.
Hammerspoon Tests
hs.hotkey.bind(ctrl_opt_cmd, "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(ctrl_opt_cmd, "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(ctrl_opt_cmd, "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 / 2
win:setFrame(f)
end)
hs.hotkey.bind(ctrl_opt_cmd, "Down", 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment