Resize window with keyboard

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('SUPER + ALT + h', window.resize(left), opts('left'))
hl.bind('SUPER + ALT + j', window.resize(down), opts('down'))
hl.bind('SUPER + ALT + k', window.resize(up), opts('up'))
hl.bind('SUPER + 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 {} ?