Go to file
Sindre Sorhus f9edc91db6 2.0.0 2018-09-29 02:09:16 +07:00
Sources 2.0.0 2018-09-29 02:09:16 +07:00
.editorconfig meta tweaks 2016-03-26 16:11:26 +07:00
.gitattributes Upgrade to Swift 4.2 2018-09-26 11:27:19 +07:00
.gitignore Upgrade to Swift 4.2 2018-09-26 11:27:19 +07:00
Config.xcconfig Expose the API in the package 2018-09-26 14:13:48 +07:00
Package.resolved Upgrade to Swift 4.2 2018-09-26 11:27:19 +07:00
Package.swift Expose the API in the package 2018-09-26 14:13:48 +07:00
fixture.jpg add fixtures 2015-10-06 08:27:27 +07:00
fixture2.jpg add fixtures 2015-10-06 08:27:27 +07:00
license Meta tweaks 2017-09-18 14:11:00 +07:00
readme.md 2.0.0 2018-09-29 02:09:16 +07:00

readme.md

macos-wallpaper

Manage the desktop wallpaper on macOS

This is both a command-line app and a Swift package.

It correctly handles getting the active wallapaper even when the wallpaper is set to a directory.

Requires macOS 10.12 or later.

CLI

Install

Homebrew
$ brew install wallpaper
Manually

Download the binary and put it in /usr/local/bin.

Usage

Usage: wallpaper <command> [options]

Manage the desktop wallpaper

Commands:
  set             Set wallpaper image. Usage: set <path>
  get             Get current wallpaper image
  screens         List screens
  help            Prints help information
  version         Prints the current version of this app

By default, it sets and gets the wallpaper for all screens. Use the --screen flag to change this.

Set
$ wallpaper set unicorn.jpg
Get
$ wallpaper get
/Users/sindresorhus/unicorn.jpg

API

Install

With Swift Package Manager:

.package(url: "https://github.com/sindresorhus/macos-wallpaper", from: "2.0.0")

Usage

import Wallpaper

let imageURL = URL(fileURLWithPath: "<path>")

try! Wallpaper.set(imageURL, screen: .main, scale: .fill)

print(try! Wallpaper.get(screen: .main))

See the source for more.

Dev

Run

swift run wallpaper

Build

swift build --configuration=release -Xswiftc -static-stdlib

Generate Xcode project

swift package generate-xcodeproj --xcconfig-overrides=Config.xcconfig
  • wallpaper - Get or set the desktop wallpaper cross-platform (Uses this binary)

License

MIT © Sindre Sorhus