macos wallpaper
v2.3.2
Administre el fondo de pantalla de escritorio en macOS
Esta es tanto una aplicación de línea de comandos como un paquete Swift.
Maneja correctamente obtener el fondo de pantalla activo incluso cuando el fondo de pantalla está configurado en un directorio.
Requiere MacOS 10.14.4 o posterior.
brew install wallpaper Descargue el binario y póngalo en /usr/local/bin .
Por defecto, establece y obtiene el fondo de pantalla para todas las pantallas. Use el indicador --screen para cambiar esto.
$ 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.jpgConstruir esto requiere la última versión de Xcode y MacOS. El paquete admite MacOS 10.14.4 o posterior.
Agregue lo siguiente al Package.swift :
. package ( url : " https://github.com/sindresorhus/macos-wallpaper " , from : " 2.3.2 " )O agregue el paquete en 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 ) )Vea la fuente para más.
swift run wallpaperswift build --configuration=release --arch arm64 --arch x86_64 && mv .build/apple/Products/Release/wallpaper . Do Not Disturb