Skip to content

Commit

Permalink
Add fit hs resize bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
drn committed Dec 18, 2024
1 parent 8e05ffd commit 274dc36
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ local resizebindings = {
bottomright = ']',
right = 'right',
left = 'left',
top = 'up',
bottom = 'down',
fitTop = 'up',
fitBottom = 'down',
full = 'return',
fitVertical = "'",
fitHorizontal = ";"
Expand Down
24 changes: 13 additions & 11 deletions hammerspoon/resize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,22 @@ end

local units = {
-- Quadrants
topleft = { x=0, y=0, w=0.5, h=0.5 },
topright = { x=0.5, y=0, w=0.5, h=0.5 },
bottomleft = { x=0, y=0.5, w=0.5, h=0.5 },
bottomright = { x=0.5, y=0.5, w=0.5, h=0.5 },
topleft = { x=0, y=0, w=0.5, h=0.5 },
topright = { x=0.5, y=0, w=0.5, h=0.5 },
bottomleft = { x=0, y=0.5, w=0.5, h=0.5 },
bottomright = { x=0.5, y=0.5, w=0.5, h=0.5 },
-- Halves
right = { x=0.5, y=0, w=0.5, h=1 },
left = { x=0, y=0, w=0.5, h=1 },
top = { x=0, y=0, w=1, h=0.5 },
bottom = { x=0, y=0.5, w=1, h=0.5 },
right = { x=0.5, y=0, w=0.5, h=1 },
left = { x=0, y=0, w=0.5, h=1 },
top = { x=0, y=0, w=1, h=0.5 },
bottom = { x=0, y=0.5, w=1, h=0.5 },
-- Fullscreen
full = { x=0, y=0, w=1, h=1 },
full = { x=0, y=0, w=1, h=1 },
-- Fit
fitVertical = { x=0, y=0.25, w=1, h=0.6 },
fitHorizontal = { x=0.2, y=0, w=0.6, h=1 }
fitVertical = { x=0, y=0.25, w=1, h=0.5 },
fitHorizontal = { x=0.22, y=0, w=0.56, h=1 },
fitTop = { x=0.22, y=0, w=0.56, h=0.5 },
fitBottom = { x=0.22, y=0.5, w=0.56, h=0.5 },
}
for name,unit in pairs(units) do
resize[name] = function() setUnit(unit) end
Expand Down

0 comments on commit 274dc36

Please sign in to comment.