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