This script fetches the daily Bing wallpaper and automatically sets it as the desktop background on Linux (Ubuntu/GNOME), macOS, or Windows.
- Fetches the latest Bing wallpaper.
- Automatically updates the wallpaper based on your operating system.
- Supports:
- Linux (Ubuntu/GNOME)
- macOS
- Windows
Ensure you have the following installed:
- Python 3.x
- pip (Python package installer)
Install required Python libraries using:
pip install requests
# OR
pip install -r requirements.txt
- The script fetches Bing’s daily wallpaper JSON metadata.
- It downloads the wallpaper image.
- It automatically updates your desktop wallpaper based on your operating system:
- Ubuntu (GNOME): Uses
gsettings
to set the wallpaper. - macOS: Uses
osascript
to update the wallpaper. - Windows: Uses the
ctypes
library to change the wallpaper.
- Ubuntu (GNOME): Uses
- Clone or download this repository to your local machine.
- Run the script with Python:
python main.py
The script will automatically detect your operating system and update the wallpaper accordingly.
You can automate the process of updating your wallpaper daily using a cron job (for Linux/macOS) or a scheduled task (for Windows).
-
Open your terminal.
-
Edit your crontab file using the following command:
crontab -e
-
Add the following line to the crontab file to run the script daily at 7 AM:
0 7 * * * /usr/bin/python3 /path/to/your/script/main.py
0 7 * * *
: This cron expression runs the script every day at 7:00 AM.- Replace
/path/to/your/script/main.py
with the actual path to your Python script.
-
Save and exit the crontab editor. Your cron job is now set up to change the wallpaper automatically every day.
-
Open Task Scheduler by searching for it in the Start Menu.
-
Click Create Basic Task in the right sidebar.
-
Name your task (e.g., "Bing Wallpaper Update") and click Next.
-
Choose Daily as the trigger and click Next.
-
Set the time (e.g., 7:00 AM) and click Next.
-
Select Start a Program and click Next.
-
In the Program/script field, browse to the path of your Python executable (e.g.,
python.exe
). -
In the Add arguments field, add the path to your
set_wallpaper.py
script. For example:C:\path\to\your\script\main.py
-
Click Next and Finish.
Your task is now scheduled to run daily and automatically change the wallpaper.
-
For Linux/macOS, you can verify that the cron job is running correctly by checking the cron log:
grep CRON /var/log/syslog
-
For Windows, check the Task Scheduler Library to verify the task status and history.