Skip to main content
Glama
views.py1.46 kB
from src.tree.views import TreeState from dataclasses import dataclass from tabulate import tabulate from typing import Optional from PIL.Image import Image from enum import Enum class Browser(Enum): CHROME='Chrome' EDGE='Edge' FIREFOX='Firefox' class Status(Enum): MAXIMIZED='Maximized' MINIMIZED='Minimized' NORMAL='Normal' HIDDEN='Hidden' @dataclass class App: name:str depth:int status:Status size:'Size' handle: int process_id:int def to_row(self): return [self.name, self.depth, self.status.value, self.size.width, self.size.height, self.handle] @dataclass class Size: width:int height:int def to_string(self): return f'({self.width},{self.height})' @dataclass class DesktopState: apps:list[App] active_app:Optional[App] screenshot:Image|None tree_state:TreeState def active_app_to_string(self): if self.active_app is None: return 'No active app found' headers = ["Name", "Depth", "Status", "Width", "Height", "Handle"] return tabulate([self.active_app.to_row()], headers=headers, tablefmt="simple") def apps_to_string(self): if not self.apps: return 'No apps running in background' headers = ["Name", "Depth", "Status", "Width", "Height", "Handle"] rows = [app.to_row() for app in self.apps] return tabulate(rows, headers=headers, tablefmt="simple")

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/CursorTouch/Windows-MCP'

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