himawaripy
himawaripy copied to clipboard
OSX Improvements
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 ;)
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.
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. :)
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...
Thanks for your contribution!
Let me try breaking your script down into pieces:
-
/usr/local/bin/mogrify -gravity south -crop ...
I assume this is where you crop the image. I am fairly sure that there is a way to achieve this using PIL (pillow) so if you'd like to look into that and send a PR I'd be really happy to merge!
-
I think timestamps are not a bad idea, so go ahead if you'd like to, and please put it behind a feature flag. Also, I think the timestamp of the image is a better idea than the current time. =)
- You should add flags for font size, the font, and positioning too ({ top, middle, bottom } x { left, center, right }).
-
/usr/bin/sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db ...
You can change utils.py to implement this; but wouldn't restarting the Dock cause any flickers or other problems? I feel like there has to be a better way of doing this instead of modifying an SQLite database and restarting system programs.
Thanks again!