From 9fd1171c2cb74c098e4ad8bf94166a1710eca187 Mon Sep 17 00:00:00 2001 From: Lukas Cech Date: Mon, 20 Jan 2025 15:07:33 +0100 Subject: [PATCH] Update window tiling --- home-manager/hammerspoon/window-tiling.lua | 30 +++++----------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/home-manager/hammerspoon/window-tiling.lua b/home-manager/hammerspoon/window-tiling.lua index 90fc2a7..334f42c 100644 --- a/home-manager/hammerspoon/window-tiling.lua +++ b/home-manager/hammerspoon/window-tiling.lua @@ -10,7 +10,6 @@ end) local wm = { sizes = { 1 / 2, 2 / 3, 1 / 3 }, - fullScreenSizes = { 1, 3 / 4, 1 / 2 }, } 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 oppAxis = dim == "w" and "y" or "x" local win = hs.window.frontmostWindow() - local id = win:id() local screen = win:screen() local cell = hs.grid.get(win, screen) @@ -45,31 +43,17 @@ function wm:_nextStep(dim, offs, cb) end end -function wm:_nextFullScreenStep() +function wm:_fullscreen() if hs.window.focusedWindow() then local win = hs.window.frontmostWindow() - local id = win:id() local screen = win:screen() local cell = hs.grid.get(win, screen) - local nextSize = self.fullScreenSizes[1] - for i = 1, #self.fullScreenSizes do - if - cell.w == self.GRID.w * self.fullScreenSizes[i] - 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 + cell.x = 0 + cell.y = 0 + cell.w = self.GRID.w + cell.h = self.GRID.h hs.grid.set(win, cell, screen) end @@ -163,8 +147,8 @@ function wm:init() end) hs.hotkey.bind(hyper, "m", function() - self:_nextFullScreenStep() - end) + self:_fullscreen() + end) end wm:init()