boramalper / himawaripy

Set near-realtime picture of Earth as your desktop background
http://labs.boramalper.org/himawaripy
MIT License
1.62k stars 239 forks source link

OSX Improvements #95

Open davidmckenzie opened 6 years ago

davidmckenzie commented 6 years ago

Probably not worth a PR, but wanted to drop in some customisations I made to the scripts for OSX:

Created /usr/local/bin/himawari.sh to be run via the scheduled job:

#!/bin/bash
/usr/local/bin/himawaripy --auto-offset -l 8
/usr/local/bin/mogrify -gravity south -crop 4400x2475+0+0 +repage /Users/x/Library/Caches/himawaripy/`ls -ABrt1 /Users/x/Library/Caches/himawaripy | tail -n1`
/usr/local/bin/mogrify -gravity south -stroke none -fill 'rgb(200,200,200)' -pointsize 36 -annotate 0 "$(date)" +repage /Users/x/Library/Caches/himawaripy/`ls -ABrt1 /Users/x/Library/Caches/himawaripy | tail -n1`
/usr/bin/sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '/Users/x/Library/Caches/himawaripy/`ls -ABrt1 /Users/x/Library/Caches/himawaripy | tail -n1`'" && killall Dock

This does a few things - it crops the image to 16:9 aspect ratio, anchored to the bottom of the image to capture that sweet view of Australia, and adds a timestamp to the bottom of the image.

It also uses an alternative method of setting the desktop image, since the native method doesn't apply the image to secondary desktops on macOS Sierra.

Dodgy af, but hopefully helps someone with the same issue ;)

jcmiller11 commented 6 years ago

I can't test in Sierra myself, but the way the image is set right now is SUPPOSED to apply to secondary desktops, does anyone know when/what changed?

Also, cool idea to add some options for processing the image to be a bit prettier. The head of this project, @boramalper I believe has stated in the past that one of his goals for this project is to keep the pre-reqs to a minimum, so if someone wanted implement something similar using PIL instead of mogrify since we're already requiring it, that might make it into a good pull.

HaoweiCh commented 5 years ago

It does support all desktop as I tested my Mojave... the feature you mentioned it's great, I'll try to make it and trust me it's worth a PR if you can. :)

HaoweiCh commented 5 years ago

see #102. I've changed readme and code to support better ratio... I only have mac so I didn't now whether it's shows perfect under linux or what... but it's awesome now, really...

boramalper commented 5 years ago

Thanks for your contribution!

Let me try breaking your script down into pieces:

Thanks again!