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
| Parameter | Type | Description |
|---|---|---|
screen_off_timeout | number | (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_timeout | number | (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_saver | object | (optional) (Windows, Linux only) Detail information of screen_saver. (Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only |
screen_saver.timeout | number | (optional) Timeout to enter screen saver mode in seconds. (Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only |
screen_saver.is_secure | boolean | (optional) Require login after entering screen saver mode. (Linux) Support GNOME, Cinnamon and Xfce4 (with Light Locker disabled) only |
required_password_timeout | number | (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
| Property | Type | Description |
|---|---|---|
result.method | number | The method ID that generated this result. |
result.code | number | The result code. See Result Codes. |
result.timing | number | The measured time for the method call in milliseconds. |
result.timestamp | string | The timestamp in seconds of when the call was made. |
result.screen_off_timeout | object | (optional) Detail information of setting screen_off_timeout. |
result.sleep_timeout | object | (optional) Detail information of setting sleep_timeout. |
result.screen_saver | object | (optional) Detail information of setting screen_saver. |
result.required_password_timeout | object | (optional) Detail information of setting required_password_timeout. |
result.screen_off_timeout.code | number | (optional) Error code after setting screen_off_timeout. |
result.sleep_timeout.code | number | (optional) Error code after setting sleep_timeout. |
result.screen_saver.code | number | (optional) Error code after setting screen_saver. |
result.required_password_timeout.code | number | (optional) Error code after setting required_password_timeout. |
Result Codes
| Code | Name | Description |
|---|---|---|
| 0 | WAAPI_OK | The 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