Resize window with keyboard

local window = hl.dsp.window -- EDIT: Forgot this in initial post >.<
local mainMod = 'SUPER' -- EDIT: Added mainMod as a var to match OPs setup
local left = { x = -10, y = 0, relative = true }
local down = { x = 0, y = 10, relative = true }
local up = { x = 0, y = -10, relative = true }
local right = { x = 10, y = 0, relative = true }

local function opts(direction)
  return { description = 'Resize the active window ' .. direction, repeating = true }
end

hl.bind(mainMod .. ' + ALT + h', window.resize(left), opts('left'))
hl.bind(mainMod .. ' + ALT + j', window.resize(down), opts('down'))
hl.bind(mainMod .. ' + ALT + k', window.resize(up), opts('up'))
hl.bind(mainMod .. ' + ALT + l', window.resize(right), opts('right'))

Hi, thank you.

I had errors until you change the resize’s parameters. Thus I write a longer line for binding

hl.bind(mainMod .. " + ALT + h", hl.dsp.window.resize(left), opts('left'))

Shall you answer me why there is no need to

  • write hl.dsp ?
  • embrace resize’s direction or/and opts with curly brackets {} ?

Whoops, sorry mate, i forgot a crucial line to cover the hl.dsp part.
So to answer your questions:

  • write hl.dsp? - The part i forgot, local window = hl.dsp.window allows to just use window in the bindings
  • embrace resize’s direction or/and opts with curly brackets {} ? - Not really sure what you mean here, but if you are asking why i just use left,right,up & down in the binds, it is because they are previously assigned variables containing the lua table specifying the relative x and y distances to move the window.

@vito Do you know a way for it to work with a continuous press of the binding?

That’s what the repeating = true in the function arguments should do

I completely missed that part. Sorry about that.

So it works for you?

Yeap, works just fine. Thanks!