60 lines
1.1 KiB
Lua
60 lines
1.1 KiB
Lua
-- Window 50% left
|
|
hs.hotkey.bind({"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, 0)
|
|
end)
|
|
|
|
-- Window 50% right
|
|
hs.hotkey.bind({"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, 0)
|
|
end)
|
|
|
|
-- Window 100%
|
|
hs.hotkey.bind({"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
|
|
|
|
win:setFrame(f, 0)
|
|
end)
|
|
|
|
-- Window "Reset"
|
|
hs.hotkey.bind({"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
|
|
f.w = max.w / 2
|
|
f.h = max.h / 2
|
|
|
|
win:setFrame(f, 0)
|
|
win:centerOnScreen(screen, true, 0)
|
|
end)
|