move_window
Move or resize a window by specifying its title pattern and optional new coordinates or dimensions. Omitted parameters leave the current value unchanged.
Instructions
Move and/or resize a window matching the given title pattern. Any of x, y, width, height omitted leaves that dimension unchanged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title_pattern | Yes | ||
| x | No | ||
| y | No | ||
| width | No | ||
| height | No |
Implementation Reference
- server.js:196-207 (handler)The async function moveWindow(args) – executes the move_window tool logic. Checks for wmctrl, validates title_pattern, then shells out to `wmctrl -r <title> -e 0,x,y,w,h` to move/resize the window.
async function moveWindow(args) { const missing = requireBin('wmctrl'); if (missing) return errorResult(missing); if (!args.title_pattern) return errorResult('title_pattern is required'); const x = args.x ?? -1; const y = args.y ?? -1; const w = args.width ?? -1; const h = args.height ?? -1; const r = await run(BIN.wmctrl, ['-r', args.title_pattern, '-e', `0,${x},${y},${w},${h}`]); if (r.code !== 0) return errorResult(`move_window failed: ${r.stderr || r.stdout || 'unknown'}`); return textResult({ matched: args.title_pattern, geometry: { x, y, width: w, height: h } }); } - server.js:413-428 (schema)The schema/registration of the move_window tool in the TOOLS array, defining its name, description, annotations, and inputSchema (title_pattern string + optional x/y/width/height numbers).
{ name: 'move_window', description: 'Move and/or resize a window matching the given title pattern. Any of x, y, width, height omitted leaves that dimension unchanged.', annotations: { title: 'Move/resize window', destructiveHint: true }, inputSchema: { type: 'object', properties: { title_pattern: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, width: { type: 'number' }, height: { type: 'number' }, }, required: ['title_pattern'], }, }, - server.js:557-557 (registration)The HANDLERS map that registers the move_window string to the moveWindow function for JSON-RPC dispatch.
move_window: moveWindow,