Skip to main content

SetPowerOptions

Will set information about power options of the device

Syntax​

Method ID​

#define WAAPI_MID_SET_POWER_OPTIONS 30008

JSON Input Structure​

{
"input": {
"method": 30008,
"screen_off_timeout": number,
"sleep_timeout": number,
"screen_saver": {
"timeout": number,
"is_secure": boolean
},
"required_password_timeout": number
}
}

Input Properties​

ParameterTypeDescription
screen_off_timeoutnumber(optional) Timeout to turn off screen in seconds.
(Windows) Supported.
(macOS) Admin required and value will be rounded up to minute unit (meaning input: 70s (1.16 min) -> 120s (2 min)).
(Linux) Support Cinnamon and Xfce4 (with Light Locker disabled) only
sleep_timeoutnumber(optional) Timeout to sleep device in seconds.
(Windows) Supported.
(macOS) Admin required and value will be rounded up to minute unit (meaning input: 70s (1.16 min) -> 120s (2 min)).
(Linux) Support GNOME and Xfce4 (with Light Locker disabled) only
screen_saverobject(optional) (Windows, Linux only) Detail information of screen_saver.
(Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only
screen_saver.timeoutnumber(optional) Timeout to enter screen saver mode in seconds.
(Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only
screen_saver.is_secureboolean(optional) Require login after entering screen saver mode.
(Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only
required_password_timeoutnumber(optional) (Linux only) (Linux only) Timeout to require login after sleep or screen saver begins (0: never, -1: immediate, >0: number of seconds).
(Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only

JSON Output Structure​

{
"result": {
"method": 30008,
"code": number,
"timing": number,
"timestamp": string,
"screen_off_timeout": {
"code": number
},
"sleep_timeout": {
"code": number
},
"screen_saver": {
"code": number
},
"required_password_timeout": {
"code": number
}
}
}

Output Properties​

PropertyTypeDescription
result.methodnumberThe method ID that generated this result.
result.codenumberThe result code. See Result Codes.
result.timingnumberThe measured time for the method call in milliseconds.
result.timestampstringThe timestamp in seconds of when the call was made.
result.screen_off_timeoutobject(optional) Detail information of setting screen_off_timeout.
result.sleep_timeoutobject(optional) Detail information of setting sleep_timeout.
result.screen_saverobject(optional) Detail information of setting screen_saver.
result.required_password_timeoutobject(optional) Detail information of setting required_password_timeout.
result.screen_off_timeout.codenumber(optional) Error code after setting screen_off_timeout.
result.sleep_timeout.codenumber(optional) Error code after setting sleep_timeout.
result.screen_saver.codenumber(optional) Error code after setting screen_saver.
result.required_password_timeout.codenumber(optional) Error code after setting required_password_timeout.

Result Codes​

CodeNameDescription
0WAAPI_OKThe operation completed successfully.
note

Other codes may be returned. See the full Result Codes reference for the complete list.

Remarks​

Error Handling​

The results of this function are determined by the error code returned by the call. If successful, WAAPI_OK or a special success code will be returned. Always check both the function return value and the result.code field in the output JSON.

Examples​

Examples will be added here demonstrating the usage of this method.

See Also​


Last updated: 2026-10-01