Class WindowDragRequest
What a move_request or resize_request carries: the app asking to be dragged with the pointer.
The app sends it when a button is pressed on its title bar or edge.
- Only comes through while that button is held.
- Hazel moves nothing itself.
lua
window:on("resize_request", function(request, window)
if request.edges == "none" then return end
local start = request.pointer:position()
local start_size = window.size
local stop
stop = wm.input:on("pointer_move", function(event)
if #event.pointer:buttons() == 0 then return stop() end
local moved = event.position - start
local width = start_size.width + (request.edges:find("right") and moved.x or 0)
local height = start_size.height + (request.edges:find("bottom") and moved.y or 0)
window:request_size({ width = math.max(width, 50), height = math.max(height, 50) })
end)
end)Properties
request.window: Windowwindow read only
The window that asked. The same one the handler gets last.
request.pointer: Pointerpointer read only
The pointer whose button is held. Follow it with pointer_move events, or read request.pointer:position() for where the drag starts.
request.edges: string?edges read only
Which edge or corner the app wants to drag: "top", "bottom", "left", "right", "top_left", "top_right", "bottom_left" or "bottom_right".
"none"when the app didn't say.- nil for a move. A
resize_requestalways has a value.