Manage the desktop wallpaper
Clone or download
Latest commit 091c769 Jan 8, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source Code style tweaks Jan 9, 2019
.editorconfig Meta tweaks Feb 18, 2018
.gitattributes Require Node.js 8 Sep 29, 2018
.gitignore Meta tweaks Feb 18, 2018
.npmrc Meta tweaks Feb 18, 2018
.travis.yml Require Node.js 8 Sep 29, 2018
appveyor.yml Require Node.js 8 Sep 29, 2018
fixture.jpg improved fixtures Oct 6, 2015
fixture2.jpg improved fixtures Oct 6, 2015
index.js Code style tweaks Jan 9, 2019
license Meta tweaks Feb 18, 2018
package.json 4.2.0 Jan 9, 2019
readme.md Readme tweaks Oct 2, 2018
test.js Add `.screens()` method for macOS Sep 29, 2018

readme.md

wallpaper Build Status Build status

Get or set the desktop wallpaper

Works on macOS 10.12+, Linux, and Windows 10+.

Maintainer needed for the Linux part of the code. No new Linux-related changes will be accepted until someone with good Linux knowledge volunteers.

Install

$ npm install wallpaper

Usage

const wallpaper = require('wallpaper');

(async () => {
	await wallpaper.set('unicorn.jpg');

	await wallpaper.get();
	//=> '/Users/sindresorhus/unicorn.jpg'
})();

API

.get([options])

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

options

Type: Object

screen (macOS only)

Type: string number
Values: all main or the index of a screen from .screens() Default: main

The screen to get the wallpaper from.

.set(imagePath, [options])

Returns a promise.

imagePath

Type: string

Path to the image to set as the desktop wallpaper.

options

Type: Object

screen (macOS only)

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.

scale (macOS only)

Type: string
Values: auto fill fit stretch center
Default: auto

Scaling method.

.screens() (macOS only)

Returns a promise for an array of screens.

(async () => {
	await wallpaper.screens();
	//=> ['Color LCD']
})();

Related

License

MIT © Sindre Sorhus