Windows, icons and displays
A Space's app icons (batched, through the SDK's one icon cache), window previews, displays and memory and storage use.
A Space's app icons (batched, through the SDK's one icon cache), window previews, displays and memory and storage use.
app_icons answers a whole window list in one call: cached icons come from memory or $CUA_HOME/cache/icons, and every miss costs one guest round trip. window_thumbnail previews one window, reused for a few seconds. displays lists the displays with their resolution and usage the memory and storage use.
Methods of Space.
Space.app_icons#Icons for many windows' apps at once, in request order (None: the
Space has no icon for that app; show none). Answered by the SDK's
one icon cache (memory, then $CUA_HOME/cache/icons, keyed by the
app and the Space's image, never the pid); every miss costs one
guest round trip for the whole batch. macOS renders the app bundle
of the pid; Linux reads the .desktop entry's Icon= from the icon
theme; Windows has none.
async def app_icons(self, requests: List[SpaceAppIconRequest]) -> List[Optional[SpaceAppIcon]]| Parameter | Type | Default |
|---|---|---|
requests | Vec<SpaceAppIconRequest> | required |
Returns Vec<Option<SpaceAppIcon>> · Async · Raises CuaError
Space.app_icon#The icon the guest desktop shows for a window's app (pass the
window's app_name, app_id and pid), or None when the Space
has none: show no icon then, not a placeholder. A window list should
ask Space.app_icons once for all its windows instead.
async def app_icon(self, app_name: str, app_id: str, pid: int) -> Optional[SpaceAppIcon]| Parameter | Type | Default |
|---|---|---|
app_name | String | required |
app_id | String | required |
pid | u32 | required |
Returns Option<SpaceAppIcon> · Async · Raises CuaError
Space.window_thumbnail#A small JPEG preview of one of the Space's windows (window_id and
epoch from windows), at most max_dimension px, reused for a
few seconds (the SDK's preview cache); None when the guest
captured nothing.
async def window_thumbnail(self, window_id: str, epoch: int, max_dimension: int) -> Optional[bytes]| Parameter | Type | Default |
|---|---|---|
window_id | String | required |
epoch | u64 | required |
max_dimension | u32 | required |
Returns Option<Vec<u8>> · Async · Raises CuaError
Space.displays#The Space's displays, primary first, with their resolution in physical pixels.
async def displays(self) -> List[SpaceDisplay]Returns Vec<SpaceDisplay> · Async · Raises CuaError
Space.usage#Memory and storage use now (cheap: poll it at a low rate while a detail is visible).
async def usage(self) -> SpaceUsageReturns SpaceUsage · Async · Raises CuaError
SpaceAppIcon record#An app icon from Space.app_icons: the icon the guest desktop uses,
normalized by the SDK's icon cache.
Returned by Space.app_icon, Space.app_icons.
| Field | Type | Default | Description |
|---|---|---|---|
bytes | Vec<u8> | The 64 px PNG (2x), or an SVG the guest could not rasterize. | |
content_type / contentType | String | image/png or image/svg+xml. | |
bytes_1x / bytes1x | Vec<u8> | The 32 px PNG (1x); empty for an SVG. |
SpaceAppIconRequest record#One window's app, for Space.app_icons.
| Field | Type | Default | Description |
|---|---|---|---|
app_name / appName | String | App name, as the window list reports it. | |
app_id / appId | String | "" | App id (bundle id, .desktop id). |
pid | u32 | 0 | A process of the app (0 when unknown). |
SpaceDisplay record#One of a Space's displays (Space.displays).
Returned by Space.displays.
| Field | Type | Default | Description |
|---|---|---|---|
id | String | Display id. | |
name | String | Name ("XVFB-0", "Built-in Retina Display"). | |
primary | bool | The primary display. | |
width_px / widthPx | u32 | Framebuffer width in physical pixels. | |
height_px / heightPx | u32 | Framebuffer height in physical pixels. | |
scale_factor / scaleFactor | f64 | Physical pixels per logical point. |
SpaceUsage record#Memory and storage use (Space.usage). A size is the guest's own
limit only when its *_limited flag says so (a VM's memory or disk, a
container's cgroup memory limit).
Returned by Space.usage.
| Field | Type | Default | Description |
|---|---|---|---|
memory_used / memoryUsed | u64 | Memory in use, bytes. | |
memory_total / memoryTotal | u64 | Memory size, bytes. | |
memory_limited / memoryLimited | bool | memory_total is the guest's limit. | |
disk_used / diskUsed | u64 | Home filesystem bytes in use. | |
disk_total / diskTotal | u64 | Home filesystem size, bytes. | |
disk_limited / diskLimited | bool | disk_total is the guest's own disk. |