-- My mouse moving codelocal io = iolocal print = printlocal pairs = pairslocal capi ={ mouse = mouse, client = client, mousegrabber = mousegrabber}local math = mathmodule("mymouse")local corners = { top_left = { top = true, left = true, icon = "top_left_corner" }, top_edge = { top = true, icon = "top_side" }, top_right = { top = true, right = true, icon = "top_right_corner" }, left_edge = { left = true, icon = "left_side" }, right_edge = { right = true, icon = "right_side" }, bottom_left = { bottom = true, left = true, icon = "bottom_left_corner" }, bottom_edge = { bottom = true, icon = "bottom_side" }, bottom_right = { bottom = true, right = true, icon = "bottom_right_corner" }}local corner_size = 100local function find_corner(win, mouse) local w = win.width local h = win.height local cx = w / 2 local cy = h / 2 local x = mouse.x - win.x local y = mouse.y - win.y if x < cx and x < corner_size then if y < cy and y < corner_size then return corners.top_left elseif h - y < corner_size then return corners.bottom_left end elseif w - x < corner_size then if y < cy and y < corner_size then return corners.top_right elseif h - y < corner_size then return corners.bottom_right end end if cy - math.abs(y - cy) < cx - math.abs(x -cx) then if y > cy then return corners.bottom_edge else return corners.top_edge end else if x > cx then return corners.right_edge else return corners.left_edge end endendlocal function equal(t1, t2) for i = 1,#t1 do if t1[i] ~= t2[i] then return false end end return trueendfunction resize(c) local c = c or capi.client.focus local mc = capi.mouse.coords() local geo = c:geometry() local corner = find_corner(geo, mc) capi.mousegrabber.run( function (mouse) if not equal(mouse.buttons, mc.buttons) then return false end local dx = mouse.x - mc.x local dy = mouse.y - mc.y if corner.left then geo.x = geo.x + dx geo.width = geo.width - dx elseif corner.right then geo.width = geo.width + dx end if corner.top then geo.y = geo.y + dy geo.height = geo.height - dy elseif corner.bottom then geo.height = geo.height + dy end c:geometry(geo) mc = mouse return true end, corner.icon)end