Skip to main content
Glama
alderban107

hyprland-mcp

by alderban107

move_window

Move windows to specific screen positions or workspaces in Hyprland desktop environments. Use coordinates for precise placement or workspace names for organization.

Instructions

Move a window to a position or workspace.

Args: target: Window selector. If omitted, moves the active window. x: Target X position in pixels y: Target Y position in pixels workspace: Target workspace name/number to move the window to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNo
xNo
yNo
workspaceNo

Implementation Reference

  • The `move_window` tool handler function, which dispatches `movewindowpixel` or `movetoworkspace` commands to Hyprland based on the provided arguments.
    @mcp.tool()
    async def move_window(
        target: str | None = None,
        x: int | None = None,
        y: int | None = None,
        workspace: str | None = None,
    ) -> str:
        """Move a window to a position or workspace.
    
        Args:
            target: Window selector. If omitted, moves the active window.
            x: Target X position in pixels
            y: Target Y position in pixels
            workspace: Target workspace name/number to move the window to
        """
        results = []
        addr = target or ""
        if x is not None and y is not None:
            await hyprctl.dispatch("movewindowpixel", f"exact {x} {y},{addr}")
            results.append(f"Moved to ({x},{y})")
        if workspace is not None:
            if target:
                await hyprctl.dispatch("movetoworkspace", f"{workspace},{target}")
            else:
                await hyprctl.dispatch("movetoworkspace", workspace)
            results.append(f"Moved to workspace {workspace}")
        if not results:
            return "No position or workspace specified — nothing to do."
        return "; ".join(results)

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