macos-wallpaper

Manage the desktop wallpaper on macOS

Github星跟蹤圖

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]
  -h, --help          Show help information
Set
$ wallpaper set unicorn.jpg
Get
$ wallpaper get
/Users/sindresorhus/unicorn.jpg

API

Install

With SwiftPM:

.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

Generate Xcode project

swift package generate-xcodeproj --xcconfig-overrides=Config.xcconfig

主要指標

概覽
名稱與所有者sindresorhus/macos-wallpaper
主編程語言Swift
編程語言Swift (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2015-04-03 06:10:14
推送於2024-09-16 15:44:45
最后一次提交
發布數11
最新版本名稱v2.3.2 (發布於 2024-09-16 22:44:44)
第一版名稱1.0.0 (發布於 2015-04-03 13:13:07)
用户参与
星數657
關注者數14
派生數39
提交數51
已啟用問題?
問題數40
打開的問題數14
拉請求數6
打開的拉請求數0
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?