Update window tiling
This commit is contained in:
parent
edac0da023
commit
9fd1171c2c
@ -10,7 +10,6 @@ end)
|
|||||||
|
|
||||||
local wm = {
|
local wm = {
|
||||||
sizes = { 1 / 2, 2 / 3, 1 / 3 },
|
sizes = { 1 / 2, 2 / 3, 1 / 3 },
|
||||||
fullScreenSizes = { 1, 3 / 4, 1 / 2 },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wm:_nextStep(dim, offs, cb)
|
function wm:_nextStep(dim, offs, cb)
|
||||||
@ -19,7 +18,6 @@ function wm:_nextStep(dim, offs, cb)
|
|||||||
local oppDim = dim == "w" and "h" or "w"
|
local oppDim = dim == "w" and "h" or "w"
|
||||||
local oppAxis = dim == "w" and "y" or "x"
|
local oppAxis = dim == "w" and "y" or "x"
|
||||||
local win = hs.window.frontmostWindow()
|
local win = hs.window.frontmostWindow()
|
||||||
local id = win:id()
|
|
||||||
local screen = win:screen()
|
local screen = win:screen()
|
||||||
|
|
||||||
local cell = hs.grid.get(win, screen)
|
local cell = hs.grid.get(win, screen)
|
||||||
@ -45,31 +43,17 @@ function wm:_nextStep(dim, offs, cb)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function wm:_nextFullScreenStep()
|
function wm:_fullscreen()
|
||||||
if hs.window.focusedWindow() then
|
if hs.window.focusedWindow() then
|
||||||
local win = hs.window.frontmostWindow()
|
local win = hs.window.frontmostWindow()
|
||||||
local id = win:id()
|
|
||||||
local screen = win:screen()
|
local screen = win:screen()
|
||||||
|
|
||||||
local cell = hs.grid.get(win, screen)
|
local cell = hs.grid.get(win, screen)
|
||||||
|
|
||||||
local nextSize = self.fullScreenSizes[1]
|
cell.x = 0
|
||||||
for i = 1, #self.fullScreenSizes do
|
cell.y = 0
|
||||||
if
|
cell.w = self.GRID.w
|
||||||
cell.w == self.GRID.w * self.fullScreenSizes[i]
|
cell.h = self.GRID.h
|
||||||
and cell.h == self.GRID.h * self.fullScreenSizes[i]
|
|
||||||
and cell.x == (self.GRID.w - self.GRID.w * self.fullScreenSizes[i]) / 2
|
|
||||||
and cell.y == (self.GRID.h - self.GRID.h * self.fullScreenSizes[i]) / 2
|
|
||||||
then
|
|
||||||
nextSize = self.fullScreenSizes[(i % #self.fullScreenSizes) + 1]
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
cell.w = self.GRID.w * nextSize
|
|
||||||
cell.h = self.GRID.h * nextSize
|
|
||||||
cell.x = (self.GRID.w - self.GRID.w * nextSize) / 2
|
|
||||||
cell.y = (self.GRID.h - self.GRID.h * nextSize) / 2
|
|
||||||
|
|
||||||
hs.grid.set(win, cell, screen)
|
hs.grid.set(win, cell, screen)
|
||||||
end
|
end
|
||||||
@ -163,7 +147,7 @@ function wm:init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind(hyper, "m", function()
|
hs.hotkey.bind(hyper, "m", function()
|
||||||
self:_nextFullScreenStep()
|
self:_fullscreen()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user