Get or set the desktop wallpaper
Works on macOS 10.12+, Linux, and Windows 10+ Windows 7+.
$ npm install wallpaper
const wallpaper = require('wallpaper');
(async () => {
await wallpaper.set('unicorn.jpg');
await wallpaper.get();
//=> '/Users/sindresorhus/unicorn.jpg'
})();
Returns a promise for the path of the current desktop wallpaper.
Type: Object
Type: string
number
Values: all
main
or the index of a screen from .screens()
Default: main
The screen to get the wallpaper from.
Returns a promise.
Type: string
The path to the image to set as the desktop wallpaper.
Type: Object
Type: string
number
Values: all
main
or the index of a screen from .screens()
Default: all
The screen to set the wallpaper on.
On Linux and Windows it's hard-coded to main
.
Type: string
Values: auto
fill
fit
stretch
center
tile
Default: fill
Scaling method.
Returns a promise for the available screens.
(async () => {
await wallpaper.screens();
//=> ['Color LCD']
})();
- macos-wallpaper - macOS binary used in this module
- winwallpaper - Windows binary used in this module
MIT © Tony Song