close_window
Close windows in Hyprland desktop environments. Specify a target window or close the active window directly. Sends WM_CLOSE signal, allowing applications to show save dialogs when needed.
Instructions
Close a window (sends WM_CLOSE — apps can show save dialogs).
Args: target: Window selector (e.g. "class:firefox"). If omitted, closes the active window.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No |
Implementation Reference
- hyprland_mcp/server.py:122-130 (handler)The `close_window` function is defined here as an MCP tool, which calls `hyprctl.dispatch("closewindow", target or "")` to interface with the Hyprland compositor.
@mcp.tool() async def close_window(target: str | None = None) -> str: """Close a window (sends WM_CLOSE — apps can show save dialogs). Args: target: Window selector (e.g. "class:firefox"). If omitted, closes the active window. """ await hyprctl.dispatch("closewindow", target or "") return f"Closed window{f' matching {target!r}' if target else ' (active)'}"