JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib Require Node.js 6 May 7, 2018
.editorconfig Meta tweaks Feb 18, 2018
.gitattributes Meta tweaks Feb 18, 2017
.gitignore Meta tweaks Feb 18, 2018
.npmrc Meta tweaks Feb 18, 2018
.travis.yml Require Node.js 6 May 7, 2018
appveyor.yml Require Node.js 6 May 7, 2018
fixture.jpg improved fixtures Oct 6, 2015
fixture2.jpg improved fixtures Oct 6, 2015
index.js OS X → macOS Jun 14, 2016
license Meta tweaks Feb 18, 2018
package.json 3.0.0 May 7, 2018
readme.md Meta tweaks Feb 18, 2018
test.js Meta tweaks Feb 18, 2018

readme.md

wallpaper Build Status Build status

Get or set the desktop wallpaper

Works on macOS, Linux, and Windows.

Install

$ npm install wallpaper

Usage

const wallpaper = require('wallpaper');

wallpaper.set('unicorn.jpg').then(() => {
	console.log('done');
});

wallpaper.get().then(imagePath => {
	console.log(imagePath);
	//=> '/Users/sindresorhus/unicorn.jpg'
});

API

.get()

Returns a promise for the path of the current desktop wallpaper.

.set(imagePath, [options])

Returns a promise.

imagePath

Type: string

Path to the image to set as the desktop wallpaper.

options

Type: Object

scale

Type: string
Values: fill fit stretch center
Default: Current system setting

Scaling method. Only available on macOS.

Related

License

MIT © Sindre Sorhus