focus_window
Focus a specific window in Hyprland by class or title to manage desktop automation tasks. Use window selectors like "class:firefox" or "title:My Document" to target windows.
Instructions
Focus a window by class or title.
Args: target: Window selector — "class:firefox", "title:My Document", etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes |
Implementation Reference
- hyprland_mcp/server.py:111-119 (handler)The 'focus_window' tool is defined as an async function in 'server.py' using the 'mcp.tool()' decorator. It takes a 'target' string and calls 'hyprctl.dispatch("focuswindow", target)' to execute the focus action via Hyprland.
@mcp.tool() async def focus_window(target: str) -> str: """Focus a window by class or title. Args: target: Window selector — "class:firefox", "title:My Document", etc. """ await hyprctl.dispatch("focuswindow", target) return f"Focused window matching '{target}'"