Apply a window layout preset
hs_window_layoutSnap a window to a named position like left-half or quarter-top-left without pixel math. Positions respect the menu bar and Dock; defaults to the focused window.
Instructions
Snap a window to a named position such as left-half or quarter-top-left, computed from the screen size so no pixel arithmetic is needed. Defaults to the focused window. Positions respect the menu bar and Dock.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| preset | Yes | Named layout to apply. | |
| windowId | No | Window id from hs_list_windows. Defaults to the focused window. | |
| screenIndex | No | Zero-based screen index from hs_screens. Defaults to the screen the window is already on. Use this to move a window to another display and position it in one call. |