screen_locked · set_screen_locked
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Read whether the screen is locked, or lock and unlock it. These call app_lock.
screen_locked
def screen_locked() -> bool
Whether the screen is locked.
set_screen_locked
def set_screen_locked(locked: bool) -> bool
Lock or unlock the screen, confirmed against the device.
A state rather than a power-button press: power is a toggle, so asking twice leaves the device where it started. A device with a PIN, pattern or password cannot be unlocked from outside and raises.
Examples
Lock the screen
device.set_screen_locked(True)
Unlock it
device.set_screen_locked(False)