create_quad_layout
Arrange four applications in a 2x2 grid layout on a specified display using the Moom MCP Server for macOS window management.
Instructions
Create a quad (2x2) window layout on a specific display
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layoutName | Yes | Name for the quad layout | |
| display | No | Which display to use | |
| apps | Yes | Array of 4 app names for TL, TR, BL, BR positions |
Implementation Reference
- src/index.js:433-512 (handler)The handler function that executes the tool logic: validates 4 apps, uses AppleScript with Moom shortcuts to position apps in TL/TR/BL/BR quadrants, and saves the layout.async createQuadLayout(layoutName, display = 'main', apps) { if (apps.length !== 4) { return { content: [{ type: 'text', text: 'Error: Quad layout requires exactly 4 apps' }] }; } const script = ` -- Rectangle shortcuts for quarters on topLeft() tell application "System Events" key code 32 using {control down, command down} -- U end tell end topLeft on topRight() tell application "System Events" key code 34 using {control down, command down} -- I end tell end topRight on bottomLeft() tell application "System Events" key code 38 using {control down, command down} -- J end tell end bottomLeft on bottomRight() tell application "System Events" key code 40 using {control down, command down} -- K end tell end bottomRight -- Position apps in quarters tell application "${apps[0]}" to activate delay 0.5 topLeft() delay 0.5 tell application "${apps[1]}" to activate delay 0.5 topRight() delay 0.5 tell application "${apps[2]}" to activate delay 0.5 bottomLeft() delay 0.5 tell application "${apps[3]}" to activate delay 0.5 bottomRight() delay 0.5 -- Save as Moom layout tell application "Moom" save layout and replace "${layoutName}" end tell `; try { await this.runAppleScript(script); return { content: [{ type: 'text', text: `Successfully created quad layout: ${layoutName}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error creating quad layout: ${error.message}` }] }; } }
- src/index.js:82-105 (schema)Input schema definition specifying parameters: layoutName (required), display (optional), apps (array of 4 strings, required).{ name: 'create_quad_layout', description: 'Create a quad (2x2) window layout on a specific display', inputSchema: { type: 'object', properties: { layoutName: { type: 'string', description: 'Name for the quad layout', }, display: { type: 'string', enum: ['main', 'left', 'right'], description: 'Which display to use', }, apps: { type: 'array', items: { type: 'string' }, description: 'Array of 4 app names for TL, TR, BL, BR positions', }, }, required: ['layoutName', 'apps'], }, },
- src/index.js:219-220 (registration)Switch case in CallToolRequest handler that routes the tool call to the createQuadLayout method.case 'create_quad_layout': return await this.createQuadLayout(args.layoutName, args.display, args.apps);
- src/index.js:83-83 (registration)Tool name registration in the ListTools response.name: 'create_quad_layout',