ggrell / macos-wallpaper

Manage the desktop wallpaper on macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 wallpaper 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

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

$ wallpaper help

Usage: wallpaper <command> [options]

Manage the desktop wallpaper

Commands:
  set             Set wallpaper image
  get             Get current wallpaper image
  screens         List screens
  help            Prints help information
  version         Prints the current version of this app
$ wallpaper get --help

Usage: wallpaper get [options]

Get current wallpaper image

Options:
  --screen <value>    Values: all, main, <index> [Default: all]
  -h, --help          Show help information
$ wallpaper set --help

Usage: wallpaper set <path> [options]

Set wallpaper image

Options:
  --scale <value>         Values: auto, fill, fit, stretch, center [Default: auto]
  --screen <value>        Values: all, main, <index> [Default: all]
  --fill-color <value>    Format: Hex color <RRGGBB> [Default: nil]
  -h, --help              Show help information
Set
$ wallpaper set unicorn.jpg
Get
$ wallpaper get
/Users/sindresorhus/unicorn.jpg

API

Install

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, fillColor: NSColor.blue)

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

See the source for more.

Dev

Run

swift run wallpaper

Build

swift build --configuration=release

Related

About

Manage the desktop wallpaper on macOS

License:MIT License


Languages

Language:Swift 100.0%