134 lines
2.9 KiB
Lua
134 lines
2.9 KiB
Lua
local mash = {"cmd", "alt", "ctrl"}
|
|
|
|
hs.hotkey.bind(mash, "R", function() mjolnir.reload() end)
|
|
|
|
-- Make the window fullscreen
|
|
hs.hotkey.bind(mash, "F", function()
|
|
local win = hs.window.focusedWindow()
|
|
if win then win:maximize() end
|
|
end)
|
|
|
|
-- Move the window to the right 5 pixels
|
|
hs.hotkey.bind(mash, "L", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
local nx = f.x + 5
|
|
if (f.w + nx) <= scrfrm.w then
|
|
f.x = nx
|
|
win:setFrame(f)
|
|
else
|
|
f.x = scrfrm.w
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Move the window to the left 5 pixels
|
|
hs.hotkey.bind(mash, "H", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
local nx = f.x - 5
|
|
if nx >= scrfrm.x then
|
|
f.x = nx
|
|
win:setFrame(f)
|
|
else
|
|
f.x = scrfrm.x
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Move the window down 5 pixels
|
|
hs.hotkey.bind(mash, "J", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
local ny = f.y + 5
|
|
if (ny + f.h) <= scrfrm.h then
|
|
f.y = ny
|
|
win:setFrame(f)
|
|
else
|
|
f.y = scrfrm.h
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Move the window up 5 pixels
|
|
hs.hotkey.bind(mash, "K", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
local ny = f.y - 5
|
|
if ny >= scrfrm.y then
|
|
f.y = ny
|
|
win:setFrame(f)
|
|
else
|
|
f.y = scrfrm.y
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Center the window
|
|
hs.hotkey.bind(mash, "C", function()
|
|
local win = hs.window.focusedWindow()
|
|
if win then
|
|
win:centerOnScreen()
|
|
end
|
|
end)
|
|
|
|
-- Move window all the way to the up
|
|
hs.hotkey.bind(mash, "up", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
f.y = 0
|
|
win:setFrame(f)
|
|
end
|
|
end)
|
|
|
|
-- Move window all the way to the left
|
|
hs.hotkey.bind(mash, "left", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
f.x = 0
|
|
win:setFrame(f)
|
|
end
|
|
end)
|
|
|
|
-- Move window all the way to the down
|
|
hs.hotkey.bind(mash, "down", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
f.y = scrfrm.h - f.h
|
|
win:setFrame(f)
|
|
end
|
|
end)
|
|
|
|
-- Move window all the way to the right
|
|
hs.hotkey.bind(mash, "right", function()
|
|
local win = hs.window.focusedWindow()
|
|
local screen = win:screen()
|
|
local scrfrm = screen:frame()
|
|
if win then
|
|
f = win:frame()
|
|
f.x = scrfrm.w - f.w
|
|
win:setFrame(f)
|
|
end
|
|
end)
|