27 comments

[ 2.9 ms ] story [ 68.8 ms ] thread
Congrats!

One quick suggestion: I think it would be more straightforward if you used the GSettings API through PyGObject rather than running the gsettings command.

Thanks, streptomycin!

I will definitely check out PyGObject. I didn't even know it existed.

So cool! I would really love if there was an OSX version
Hey, I'm just forking it right now to have that to you. I have it mostly working, I'm just installing PIL. But apart from resizing everything works. Check back in 15 minutes.
Awesome! I'd love to link to yours when/if you get it up and running. I would very much like to make this in OSX myself, but as I said in another comment: I still don't have a Macbook.
Here you go: https://github.com/TyrGodOfWar/nasa-apod-desktop

Err, I don't know what's polite in terms of editing the readme and stuff. I hope what I did is acceptable.

It only sets it for the space I'm on when I run the script. I have no idea what will happen with crontab. But, you can also just use this to populate the folder, and have osx change the photo every hour or so from the menu.

I also removed the re-sizing. If you want to install the python imaging library, `brew install pil` works. Then just uncomment the function.

(comment deleted)
It works nicely but the image looks squashed vertically on my 1366x768 display.
The size of the image is statically defined in the script: RESOLUTION_X = 1680 RESOLUTION_Y = 1050

Change them to your screen's resolution.

Do you have to resize it in the script? I think you can just set GNOME to scale it down by itself.
The images are quite large (usually over 10MB, at least). Re-sizing them not only saves space, but ensures your desktop doesn't do anything weird when trying to scale by itself.
I would absolutely love this for osx. Good work!
Thanks very much, Jonanin!

Unfortunately, I'm still saving up for my first Macbook. Otherwise: I'd be all over this request for you.

Looks nice. Just a small warning though, a couple of times per year they will do something fancy with video or JavaScript that will probably break this.
Thanks for the heads up, slyall. I'll be sure to check so nothing weird happens.
It doesn't need to be a ubuntu/gnome only script, for example to set the wallpaper on fluxbox:

  fbsetbg -c $the_file
Working on Fedora 17 (GNOME) with two monitors. Very nice!
I just wanted an image, no text as I live in a semi-transparent terminal most of the time

This made me think of someone getting stuck living in an airport and writing this script because they miss the stars.

Which is in no way relevant or particularly useful, admittedly.

Heh, you're not too far off. When I'm developing, I use Vim with a semi-transparent terminal. Any text on the background would be terribly distracting.

I wouldn't say I'm stuck. The images of stars are my own little gateways to the Universe. I can't ever be "stuck" when I'm looking at them. I have a fascination with the stars and all things to do with space & quantum physics, so it works perfectly for me. I guess it's just something I've always been drawn to. I even have a tattoo which represents these things.

I find the stars and all celestial bodies to be comforting, beautiful, and quite inspirational. Much more than just a plain background.

I used to have a darkened version of the hubble deep field set as my terminal background and currently have a satellite photo of martian dunes and one of those absolutely mental long exposures from the ISS by Don Pettit as some of my desktop backgrounds. They are lovely, I keep meaning to find out about getting some prints. http://www.flickr.com/photos/nasa_jsc_photo/sets/72157629726...
ah, good to see the old regex for <a href="(image.?)"

I wrote a little parser for this site a while back to display the daily photo as a desktop gadget, and had to resort to the same hack to get the image out. It's a shame there isn't a rss feed for this yet.. it is a bit hard to be believe that in this day and age, thousands of pieces of code around the world are relying on how one guy decided to write his html.

[Ninja Edit:] For what it is worth, here's the regex I actually ended up using:

    ^<a\s*?href\s*?=\s*?['"](image/.+?)\1\s*?>$
but obviously, this is equally fragile.
Annnnnnd, today it's a youtube video, which fails. :(