Skip to main content

orientation · set_orientation

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Read which way the screen is turned, or turn it. These call app_orientation.

orientation​

def orientation() -> tuple[str, bool]

Which way the screen is turned, and whether that is pinned.

A screen that merely happens to be portrait can rotate under you, so the two are separate answers.

set_orientation​

def set_orientation(mode: str) -> str

Turn the screen and pin it. "auto" hands it back to the sensor.

mode is "portrait", "landscape", "portrait-reverse", "landscape-reverse" or "auto" — not "left"/"right", which the two platforms name differently. A rotation re-lays out every screen, so the refs from the last map are discarded. An activity that locks its own orientation cannot be turned from outside and raises.

Examples​

Turn the screen to landscape​

device.set_orientation("landscape")

The same call from the command line, mobium orientation landscape, printed on an Android 15 emulator:

landscape (locked) (was portrait)

mobium orientation landscape on an Android 15 emulator

mobium orientation landscape on an Android 15 emulator