用于为macOS Mojave创建动态壁纸的控制台应用程序

网友投稿 581 2022-10-27

用于为macOS Mojave创建动态壁纸的控制台应用程序

用于为macOS Mojave创建动态壁纸的控制台应用程序

wallpapper

This is simple console application for macOS to create dynamic wallpapers introduced in macOS Mojave. Here you can watch how dynamic wallpapers works. Also you can read more about dynamic wallpapers in following articles:

macOS Mojave dynamic wallpapermacOS Mojave dynamic wallpapers (II)macOS Mojave dynamic wallpapers (III)

Build and install

You need to have latest XCode (10.2) and Swift 5 installed.

Homebrew

Open your terminal and run following commands.

brew tap mczachurski/wallpapperbrew install wallpapper

Manually

Open your terminal and run following commands.

git clone https://github.com/mczachurski/wallpapper.gitcd wallpapperswift build --configuration releasesudo cp .build/x86_64-apple-macosx/release/wallpapper /usr/local/bin

If you are using swift in version 4.1, please edit Package.swift file and put there your version of swift (in first line).

Now in the console you can run wallpapper -h and you should got a response similar to the following one.

wallpapper: [command_option] -i inputFileCommand options are: -h show this message and exit -o output file name (default is 'output.heic') -i input file name, json file with wallpaper description

That's all. Now you can build your own dynamic wallpappers.

Troubleshooting

If you get an error during the Swift build portion of install, try downloading the entire Xcode IDE (not just the tools) from the app store. Then run

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

and run the installation command again.

Getting started

If you have done above commands now you can build dynamic wallpaper. It's really easy. First you have to put all you pictures into one folder and in the same folder create json file with picture's description. Application support three kinds of dynamic wallpapers.

Solar

For wallpaper which based on solar coordinates json file have to have structure like on below snippet.

[ { "fileName": "1.png", "isPrimary": true, "isForLight": true, "altitude": 27.95, "azimuth": 279.66 }, { "fileName": "2.png", "altitude": -31.05, "azimuth": 4.16 }, ... { "fileName": "16.png", "isForDark": true, "altitude": -28.63, "azimuth": 340.41 }]

Properties:

fileName - name of picture file name (you can use same file for few nodes).isPrimary - information about image which is primary image (it will be visible after creating heic file). Only one of the file can be primary.isForLight - if true picture will be displayed when user chose "Light (static)" wallpaperisForDark - if true picture will be displayed when user chose "Dark (static)" wallpaperaltitude - is the angle between the Sun and the observer's local horizon.azimuth - that is the angle of the Sun around the horizon.

To calculate proper altitude and azimuth you can use that page: https://keisan.casio.com/exec/system/1224682277. You have to put place where you take a photo and the date. Then system generate for you altitude and azimuth of the Sun during whole day.

Time

For wallpaper which based on OS time json file have to have structure like on below snippet.

[ { "fileName": "1.png", "isPrimary": true, "isForLight": true, "time": "2012-04-23T10:25:43Z" }, { "fileName": "2.png", "time": "2012-04-23T14:32:12Z" }, { "fileName": "3.png", "time": "2012-04-23T18:12:01Z" }, { "fileName": "4.png", "isForDark": true, "time": "2012-04-23T20:10:45Z" }]

Properties:

fileName - name of picture file name (you can use same file for few nodes).isPrimary - information about image which is primary image (it will be visible after creating heic file). Only one of the file can be primary.isForLight - if true picture will be displayed when user chose "Light (static)" wallpaperisForDark - if true picture will be displayed when user chose "Dark (static)" wallpapertime - time when wallpaper will be changed (most important is hour).

Apperance

For wallpapers based on OS apperance settings (light/dark) we have to prepare much simpler JSON file, and we have to use only two images (one for light and one for dark theme).

[ { "fileName": "1.png", "isPrimary": true, "isForLight": true }, { "fileName": "2.png", "isForDark": true }]

Properties:

fileName - name of picture file name.isPrimary - information about image which is primary image (it will be visible after creating heic file). Only one of the file can be primary.isForLight - if true picture will be displayed when user uses light themeisForDark - if true picture will be displayed when user uses dark theme

Preparing wallpapers

When you have json file and all pictures then you can generate heic file. You have to run following command:

wallpapper -i wallpapper.json

You should got a new file: output.heic. Set this file as a new wallpaper and enjoy you own dynamic wallpaper!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Rancher Kubernetes Engine 一个非常简单,快如闪电的Kubernetes安装程序
下一篇:TCP流量控制-TCP拥塞控制 拥塞控制与流量控制的区别
相关文章

 发表评论

暂时没有评论,来抢沙发吧~