wallpaper Module
Set the desktop wallpaper and read the current wallpaper path.
The wallpaper module is exported from the system module.
javascript
import { wallpaper } from "system";Table of Contents
wallpaper.set(path, [style])
Sets desktop wallpaper.
Parameters
path- Type:
string - Description: Image file path.
- Type:
style- Type:
string - Required: No
- Default:
"fill" - Description: Wallpaper style. Supported values include:
"fill""fit""stretch""tile""center""span"
- Type:
Return Value
- Type:
boolean - Description:
trueif wallpaper was updated; otherwisefalse.
wallpaper.getCurrentPath()
Gets the current wallpaper image path.
Return Value
- Type:
string - Description: Current wallpaper path, or empty string (
"") if unavailable.
Example
javascript
import { wallpaper } from "system";
const setOk = wallpaper.set("C:\\Wallpapers\\my-wallpaper.jpg", "fill");
console.log("set:", setOk);
const current = wallpaper.getCurrentPath();
console.log("current wallpaper:", current);