Skip to content

Python script that automatically sets the wallpaper/background image of your computer to today's NASA APOD (Astronomy Picture Of the Day).

License

Notifications You must be signed in to change notification settings

Charly98cma/APOD-Wallpaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APOD-Wallpaper

Basic Info.

G'day!

This is a quite small Python script I've created using the NASA Astronomy Picture Of the Day (APOD) API to set the APOD as your wallpaper/background image each time you run the script.

And, since we're all quite lazy, systemd will run the script on startup, after having internet connectivity, just follow the instructions down below.

Dependencies

Well, you need Python 3, pip, the program feh and the Python requests library. To download a video, you'll also need ffmpeg and youtube-dl

To install the requests library, you can run the following command and pip will install it using the requirements.txt file.

make init

The installation of feh is different depending on your distribution, but it's required to set the wallpaper/background image. If you use (or want to) a different program, I encourage you to open an Issue and I'll add support for it, or, if you want to add it yourself, feel free to create a PR with your changes.

Running script

To run the script manually, and change the wallpaper, you just have to run the next command:

make run

Now, to run the script after the system boots, you'll have to follow a few but easy steps:

  1. Run make config, to set the appropriate parameters on the apodwallpaper.service (absolute path of the Python script, in case you're wondering).
  2. Now, to enable the systemd service, run the make command make setup, which does and runs the following (requires sudo permissions):
    1. Places the service file inside /etc/systemd/user (requires sudo)
    2. Assign the appropriate permission to the service file by running sudo chmod 644 /etc/systemd/user/apodwallpaper.service. (requires sudo)
    3. Reload the systemd daemon by running systemctl --user daemon-reload
    4. Enable the service by running systemctl --user enable apodwallpaper.service

And that's all, from now on, after the system boots, the script will be executed, and the wallpaper will change.

Credentials

I'm using the default api_key on the APOD requests, since the constraints to use it are based on the user IP, which is not a problem for this project, since each user will only download the image once each day.

But, if you want to use your own key, you can request one on the NASA Open APIs web.

About

Python script that automatically sets the wallpaper/background image of your computer to today's NASA APOD (Astronomy Picture Of the Day).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published