|
|
@ -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 = {
|
|
|
|
-- TODO implement desktop and window gaps
|
|
|
|
left = hs.layout.left50,
|
|
|
|
hs.urlevent.bind("wm", function(eventName, params)
|
|
|
|
right = hs.layout.right50,
|
|
|
|
local log = hs.logger.new("wm", "debug")
|
|
|
|
ne = { 0.5, 0, 0.5, 0.5 },
|
|
|
|
|
|
|
|
nw = { 0, 0, 0.5, 0.5 },
|
|
|
|
local win = hs.window.focusedWindow() -- TODO figure out why focusedWindow doesn't work
|
|
|
|
se = { 0.5, 0.5, 0.5, 0.5 },
|
|
|
|
-- local win = hs.window.frontmostWindow()
|
|
|
|
sw = { 0, 0.5, 0.5, 0.5 },
|
|
|
|
local f = win:frame()
|
|
|
|
max = hs.layout.maximized,
|
|
|
|
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))
|
|
|
|
function move(key)
|
|
|
|
local frame = unitRect:fromUnitRect(max)
|
|
|
|
local win = hs.window.focusedWindow()
|
|
|
|
win:setFrame(frame)
|
|
|
|
local geo = wm[key]
|
|
|
|
-- win:focus()
|
|
|
|
win:move(geo, nil, true)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hs.hotkey.bind(mash, "h", function() move("left") end)
|
|
|
|
|
|
|
|
hs.hotkey.bind(mash, "l", function() move("right") end)
|
|
|
|
|
|
|
|
hs.hotkey.bind(mash, "m", function() move("max") end)
|
|
|
|
|
|
|
|
|
|
|
|
hs.loadSpoon("ReloadConfiguration")
|
|
|
|
hs.loadSpoon("ReloadConfiguration")
|
|
|
|
spoon.ReloadConfiguration:start()
|
|
|
|
spoon.ReloadConfiguration:start()
|
|
|
|