Skip to content

Display

Runnable example

python/examples/display_config.py — reads the current resolution, applies 1024×768, then restores it.

resoio.display.DisplayClient

DisplayClient(socket_path: str | None = None)

Bases: _BaseClient[DisplayStub]

Async client for the Resonite IO Display service over a UDS.

Use as an async context manager so the gRPC channel closes deterministically.

Source code in src/resoio/_client.py
def __init__(self, socket_path: str | None = None) -> None:
    # Defer resolution to __aenter__ so env vars patched between
    # construction and connection are honoured, and so resolution
    # errors surface at the connect site.
    self._explicit_path: str | None = socket_path
    self._channel: Channel | None = None
    self._stub: TStub | None = None
    self._resolved_path: str | None = None

apply async

apply(*, width: int = 0, height: int = 0, max_fps: float = 0.0) -> None

Apply a partial display config; 0 / 0.0 mean "leave unchanged".

Returns None by contract — engine settings dispatch hops to the engine thread, so the post-apply snapshot is not reliable in the same RPC. Call :meth:get afterwards if you need the new state (see display.proto for the full rationale).

Source code in src/resoio/display.py
async def apply(
    self,
    *,
    width: int = 0,
    height: int = 0,
    max_fps: float = 0.0,
) -> None:
    """Apply a partial display config; ``0`` / ``0.0`` mean "leave
    unchanged".

    Returns ``None`` by contract — engine settings dispatch hops to the
    engine thread, so the post-apply snapshot is not reliable in the
    same RPC. Call :meth:`get` afterwards if you need the new state
    (see ``display.proto`` for the full rationale).
    """
    stub = self._require_stub()
    request = DisplayConfig(width=width, height=height, max_fps=max_fps)
    await stub.apply(request)

get async

get() -> DisplayInfo

Return the engine-side display state without modifying it.

Source code in src/resoio/display.py
async def get(self) -> DisplayInfo:
    """Return the engine-side display state without modifying it."""
    stub = self._require_stub()
    state = await stub.get(DisplayGetRequest())
    return _info_from_state(state)

resoio.display.DisplayInfo dataclass

DisplayInfo(width: int, height: int, max_fps: float)

Snapshot of engine-side display settings.

max_fps is the background fps cap; foreground control is not exposed by the engine public Settings API.