MIT License

项目介绍

sindresorhus/macos-wallpaper 是一个托管在 GitHub 上的开源项目,主要使用 Swift 编写,采用 MIT License 许可证,目前获得 717 个 Star、53 次 Fork。

仓库全名
sindresorhus/macos-wallpaper
开源许可证
MIT License
Star 数
717
Fork 数
53
未关闭 Issue
11

README 摘要

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. CLI Requires macOS 10.14.4 or later. Install Homebrew 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

macos-wallpaper 用什么语言开发?

主要使用 Swift 编写,采用 MIT License 许可证,目前有 717 个 Star。

macos-wallpaper 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 macos-wallpaper 的源码?

可以直接克隆仓库:git clone https://github.com/sindresorhus/macos-wallpaper.git,默认分支为 main;安装与运行步骤见仓库 README。

macos-wallpaper 最近还在维护吗?

仓库最近一次更新为 9月20日,当前有 11 个未关闭 Issue;Star 数为 717,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Manage the desktop wallpaper on macOS

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
834
价值分
446
活跃状态
活跃

语言占比

Swift

Release

README

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.

CLI

Requires macOS 10.14.4 or later.

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

USAGE: wallpaper <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  get                     Get current wallpaper images.
  set                     Set image as wallpaper.
  set-solid-color         Set solid color as wallpaper.
  screens                 Get a list of available screens.
$ wallpaper get --help

OVERVIEW: Get current wallpaper images.

USAGE: wallpaper get [--screen <screen>]

OPTIONS:
  --screen <screen>       Values: all, main, <index> (default: all)
$ wallpaper set --help

OVERVIEW: Set image as wallpaper.

USAGE: wallpaper set <path> [--screen <screen>] [--scale <scale>] [--fill-color <fill-color>]

ARGUMENTS:
  <path>                  The path to the image to use as wallpaper.

OPTIONS:
  --screen <screen>       Values: all, main, <index> (default: all)
  --scale <scale>         Values: auto, fill, fit, stretch, center (default: auto)
  --fill-color <fill-color>
                          Format: Hex color <RRGGBB>
$ wallpaper set-solid-color --help

OVERVIEW: Set solid color as wallpaper.

USAGE: wallpaper set-solid-color <color> [--screen <screen>]

ARGUMENTS:
  <color>                 The color to use as wallpaper.

OPTIONS:
  --screen <screen>       Values: all, main, <index> (default: all)
Set
wallpaper set unicorn.jpg
Set solid color
wallpaper set-solid-color 0000ff
Get
wallpaper get
/Users/sindresorhus/unicorn.jpg

API

Building this requires the latest Xcode and macOS version. The package supports macOS 10.14.4 or later.

Install

Add the following to Package.swift:

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

Or add the package in Xcode.

Usage

import Wallpaper

let imageURL = URL(filePath: "<path>")
try! Wallpaper.set(imageURL, screen: .main, scale: .fill)

let solidColor = NSColor.blue
try! Wallpaper.set(solidColor, screen: .main)

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

See the source for more.

Note 注意

In sandboxed apps, the library gracefully handles database access restrictions and may return directory paths instead of specific image files when getting current wallpapers.

Dev

Run

swift run wallpaper

Build

swift build --configuration=release --arch arm64 --arch x86_64 && mv .build/apple/Products/Release/wallpaper .

评论

暂无评论