Reference
Arcane.system.lock()
Locks the operating-system session.
This focused page is derived from the mechanically checked full member inventory.
Syntax
Arcane.system.lock()
Parameters
None
Return value
Promise<result>
Description
Locks the operating-system session.
Overview
Arcane.system.lock() asks the operating system to lock the current desktop
session. It requires session.control, an application of type shell, and a
Core host. It is an exclusive, non-idempotent session-control request and does
not merely hide or close Arcane.
Microsoft NT dispatches the native workstation-lock command. Linux selects the
first available supported controller from loginctl, GNOME Screensaver, or
the XDG screensaver command. Simulation records only an explicitly simulated
request.
Result and side effect
On a real host the result is exactly {requested: true, accepted: true, simulated: false, command, pid}. In simulation it is exactly {requested: true, accepted: true, simulated: true, command, args}. Acceptance means the
session controller process started; it is not a later proof that the desktop is
visibly locked. No Arcane operation or completion event is emitted.
Errors and recovery
SESSION_COMMAND_UNAVAILABLE means no supported controller exists.
SESSION_COMMAND_DISPATCH_FAILED or SESSION_COMMAND_DISPATCH_TIMEOUT means
the host could not confirm process creation. METHOD_NOT_ALLOWED means the
caller is not the admitted Shell or lacks session.control. Do not retry in a
tight loop after an ambiguous timeout.
Example
async function lockSessionAfterConfirmation(confirmLock) {
if (!confirmLock()) {
return null;
}
return Arcane.system.lock();
}