get_active_window
Retrieve details about the currently focused window in Hyprland desktop environments to enable automated window management and interaction.
Instructions
Get details about the currently focused window.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- hyprland_mcp/server.py:97-108 (handler)The handler for 'get_active_window' queries the Hyprland active window status via hyprctl and returns a formatted string with window details.
@mcp.tool() async def get_active_window() -> str: """Get details about the currently focused window.""" w = await hyprctl.query("activewindow") if not w or not w.get("class"): return "No window is currently focused." return ( f"Active window: [{w['class']}] \"{w['title']}\"\n" f"Size: {w['size'][0]}x{w['size'][1]}, Position: ({w['at'][0]},{w['at'][1]})\n" f"Workspace: {w['workspace']['name']}, Monitor: {w['monitor']}\n" f"Floating: {w['floating']}, Fullscreen: {w['fullscreen']}" )