|
|
@ -2,32 +2,25 @@ local mash = {"cmd", "alt", "ctrl"}
|
|
|
|
local smash = {"cmd", "alt", "ctrl", "shift"}
|
|
|
|
local smash = {"cmd", "alt", "ctrl", "shift"}
|
|
|
|
|
|
|
|
|
|
|
|
-- Window management
|
|
|
|
-- Window management
|
|
|
|
|
|
|
|
wm = {
|
|
|
|
|
|
|
|
left = hs.layout.left50,
|
|
|
|
|
|
|
|
right = hs.layout.right50,
|
|
|
|
|
|
|
|
ne = { 0.5, 0, 0.5, 0.5 },
|
|
|
|
|
|
|
|
nw = { 0, 0, 0.5, 0.5 },
|
|
|
|
|
|
|
|
se = { 0.5, 0.5, 0.5, 0.5 },
|
|
|
|
|
|
|
|
sw = { 0, 0.5, 0.5, 0.5 },
|
|
|
|
|
|
|
|
max = hs.layout.maximized,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- TODO implement desktop and window gaps
|
|
|
|
function move(key)
|
|
|
|
hs.urlevent.bind("wm", function(eventName, params)
|
|
|
|
local win = hs.window.focusedWindow()
|
|
|
|
local log = hs.logger.new("wm", "debug")
|
|
|
|
local geo = wm[key]
|
|
|
|
|
|
|
|
win:move(geo, nil, true)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local win = hs.window.focusedWindow() -- TODO figure out why focusedWindow doesn't work
|
|
|
|
hs.hotkey.bind(mash, "h", function() move("left") end)
|
|
|
|
-- local win = hs.window.frontmostWindow()
|
|
|
|
hs.hotkey.bind(mash, "l", function() move("right") end)
|
|
|
|
local f = win:frame()
|
|
|
|
hs.hotkey.bind(mash, "m", function() move("max") end)
|
|
|
|
local screen = win:screen()
|
|
|
|
|
|
|
|
local max = screen:frame()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local t = {
|
|
|
|
|
|
|
|
left = function(f) return hs.layout.left50 end,
|
|
|
|
|
|
|
|
right = function(f) return hs.layout.right50 end,
|
|
|
|
|
|
|
|
ne = function(f) return { 0.5, 0, 0.5, 0.5 } end,
|
|
|
|
|
|
|
|
nw = function(f) return { 0, 0, 0.5, 0.5 } end,
|
|
|
|
|
|
|
|
se = function(f) return { 0.5, 0.5, 0.5, 0.5 } end,
|
|
|
|
|
|
|
|
sw = function(f) return { 0, 0.5, 0.5, 0.5 } end,
|
|
|
|
|
|
|
|
max = function(f) return hs.layout.maximized end,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local unitRect = hs.geometry(t[params["layout"]](f))
|
|
|
|
|
|
|
|
local frame = unitRect:fromUnitRect(max)
|
|
|
|
|
|
|
|
win:setFrame(frame)
|
|
|
|
|
|
|
|
-- win:focus()
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hs.loadSpoon("ReloadConfiguration")
|
|
|
|
hs.loadSpoon("ReloadConfiguration")
|
|
|
|
spoon.ReloadConfiguration:start()
|
|
|
|
spoon.ReloadConfiguration:start()
|
|
|
|