macos wallpaper
v2.3.2
管理MacOS上的桌面壁紙
這既是命令行應用程序,又是Swift軟件包。
即使將牆紙設置為目錄,它也可以正確處理有效牆紙。
需要MacOS 10.14.4或更高版本。
brew install wallpaper下載二進製文件,然後將其放入/usr/local/bin中。
默認情況下,它設置並獲取所有屏幕的牆紙。使用--screen標誌來更改此問題。
$ 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)
wallpaper set unicorn.jpgwallpaper set-solid-color 0000ffwallpaper get
/Users/sindresorhus/unicorn.jpg構建這需要最新的Xcode和MacOS版本。該軟件包支持MACOS 10.14.4或更高版本。
將以下內容添加到Package.swift中。
. package ( url : " https://github.com/sindresorhus/macos-wallpaper " , from : " 2.3.2 " )或在XCode中添加包裝。
import Wallpaper
let imageURL = URL ( fileURLWithPath : " <path> " , isDirectory : false )
try ! Wallpaper . set ( imageURL , screen : . main , scale : . fill )
let solidColor = NSColor . blue
try ! Wallpaper . set ( solidColor , screen : . main )
print ( try ! Wallpaper . get ( screen : . main ) )請參閱源。
swift run wallpaperswift build --configuration=release --arch arm64 --arch x86_64 && mv .build/apple/Products/Release/wallpaper . Do Not Disturb功能