Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/durocodes/apod
Automatically set your MacOS wallpaper to NASA's APOD 🚀
https://github.com/durocodes/apod
Last synced: 21 days ago
JSON representation
Automatically set your MacOS wallpaper to NASA's APOD 🚀
- Host: GitHub
- URL: https://github.com/durocodes/apod
- Owner: DuroCodes
- Created: 2024-06-03T05:31:48.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-07T11:50:44.000Z (7 months ago)
- Last Synced: 2024-06-07T13:06:00.876Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# APOD Wallpaper
> [!WARNING]
> This script only works on macOS.
>
> You can probably make it work on Linux by changing the `osascript` command to `gsettings` or `feh` or whatever you use to set your wallpaper.
>
> I don't know how to make it work on Windows. 💀A TypeScript script to download the Astronomy Picture of the Day from NASA and set it as your wallpaper.
If there is not an image available for the current day, it will set a random image from the `wallpapers` directory as the wallpaper. (This can happen if the APOD is a video, for example.)
It also includes a Discord webhook integration to send the APOD to a Discord channel automatically.
## Usage
1. Clone the repository.
2. Create a `.env` file with the following content:
```env
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your/webhook/url # optional for Discord integration
WALLPAPER_PATH=/path/to/your/wallpapers
```
3. Install the dependencies with `bun install`.
4. Run the script with `bun run src/index.ts`.## Automation (macOS)
If you're using a UNIX machine, you can probably use a cron job. However, it doesn't work when your machine is asleep.
This is where LaunchAgents are useful. They have similar functionality, but they also work when your macOS machine is asleep.
1. Create a `.plist` file in `~/Library/LaunchAgents` with the following content:
```xml
Label
com.example.wallpaper
ProgramArguments
/bin/bash
change_wallpaper.sh
StartCalendarInterval
Hour
1
Minute
0
RunAtLoad
```2. Create a `change_wallpaper.sh` file in your home directory with the following content:
```sh
#!/bin/bash# Change the path to the script to wherever you cloned the repository
cd "/path/to/your/repo"# Run the script using your local installation of bun
# You can find the path by running `which bun` in your terminal
# It most likely will be at /Users/YOUR_USER/.bun/bin/bun
/path/to/your/bun run "src/index.ts"
```3. Load the LaunchAgent with `launchctl load ~/Library/LaunchAgents/com.example.wallpaper.plist`.
4. Profit 🔥