Skip to main content
Glama
alderban107

hyprland-mcp

by alderban107

list_windows

Retrieve details of open windows including class, title, size, and position. Filter results by workspace or monitor to manage desktop layouts.

Instructions

List all open windows with class, title, size, and position.

Args: workspace: Filter to a specific workspace number monitor: Filter to a specific monitor name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNo
monitorNo

Implementation Reference

  • The list_windows tool handler function in hyprland_mcp/server.py. It retrieves window data via hyprctl and filters them by workspace or monitor if provided.
    @mcp.tool()
    async def list_windows(workspace: int | None = None, monitor: str | None = None) -> str:
        """List all open windows with class, title, size, and position.
    
        Args:
            workspace: Filter to a specific workspace number
            monitor: Filter to a specific monitor name
        """
        clients = await hyprctl.query("clients")
        if workspace is not None:
            clients = [c for c in clients if c["workspace"]["id"] == workspace]
        if monitor is not None:
            clients = [c for c in clients if c["monitor"] == monitor]
        if not clients:
            return "No windows found matching the filter."
        lines = []
        for c in clients:
            focused = " [focused]" if c.get("focusHistoryID") == 0 else ""
            lines.append(
                f"- [{c['class']}] \"{c['title']}\" — "
                f"{c['size'][0]}x{c['size'][1]} at ({c['at'][0]},{c['at'][1]}), "
                f"workspace {c['workspace']['name']}{focused}"
            )
        return "\n".join(lines)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alderban107/hyprland-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server