Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX Improvements #95

Open
davidmckenzie opened this issue Sep 11, 2017 · 4 comments
Open

OSX Improvements #95

davidmckenzie opened this issue Sep 11, 2017 · 4 comments

Comments

@davidmckenzie
Copy link

davidmckenzie commented Sep 11, 2017

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
Copy link
Contributor

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
Copy link
Contributor

HaoweiCh commented Sep 9, 2018

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
Copy link
Contributor

HaoweiCh commented Sep 9, 2018

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
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants