Current Version: 1.0.0
Change your desktop background using the XKCD "Now" clock or the "dark mode" rendition of it (with green overlay!)
Optionally also put a red dot on the image showing your location.
Special thanks to Randall Munroe and Fred Weinhaus
| XKCD Original | Black Green Overlay | Black Green Overlay + Red Dot |
|---|---|---|
![]() |
![]() |
![]() |
randall-clock-desktop-background/
├── README.md
├── install.sh
├── config.ini
├── requirements.txt
├── posterity.pdf
├── timeupdate.bash
├── xkcdOriginalExample.png
├── blackGreenOverlayExample.png
├── blackGreenOverlayRedDotExample.png
├── src/
│ ├── images/
│ │ ├── masks/ # Alpha masks for globe extraction
│ │ ├── overlays/ # Stationary overlay images
│ │ ├── intervals15m/ # 15-minute interval image sets
│ │ │ ├── xkcdOriginal/ # Original XKCD frames
│ │ │ └── blackGlobeGreenOverlay/ # Black globe with green overlay
│ │ └── intervals1m/ # 1-minute interval image sets
│ │ ├── blackGreenOverlay/ # 1-minute frames (no red dot)
│ │ └── blackGreenOverlayRedDot/ # 1-minute frames (with red dot)
│ └── scripts/
│ ├── generate-masks.py # Generate globe masks and overlay
│ ├── generate-frames.py # Generate 1-minute interval frames
│ ├── red-dot.py # Add red dot to frames
│ ├── pick-location.py # Pick your location for the red dot
│ └── measure-globe.py # Measure globe center/radius
└── ...
- generate-masks.py: Generates alpha masks for extracting the globe from each 15-minute frame and creates the stationary overlay.
- generate-frames.py: Generates 1-minute interval frames by rotating the globe and compositing it with the overlay.
- red-dot.py: Adds a red dot to each frame, indicating your chosen location, and rotates it with the globe.
- pick-location.py: Lets you interactively pick your location on the globe for the red dot.
- measure-globe.py: Lets you measure the center and radius of the globe for accurate dot placement.
Run:
./install.shThis will:
- Check and install dependencies (shows the apt-get command before prompting for sudo)
- Prompt for red dot, location, style, and interval
- Generate overlays, masks, frames, and red dot images as needed
- Set up a cron job for background updates
- Install dependencies:
sudo apt-get install feh imagemagick python3 python3-pip python3-tk python3-pil python3-numpy pip3 install -r requirements.txt
- Generate images:
- Generate masks and overlay:
python3 src/scripts/generate-masks.py
- Generate 1-minute frames:
python3 src/scripts/generate-frames.py
- (Optional) Pick your location for the red dot:
python3 src/scripts/pick-location.py
- (Optional) Measure globe center/radius:
python3 src/scripts/measure-globe.py
- (Optional) Add red dot to frames:
python3 src/scripts/red-dot.py
- Generate masks and overlay:
- Set up the background update:
- Make the update script executable:
chmod +x timeupdate.bash
- Add a cron job: ```bash crontab -e # For 1-minute interval: * * * * * /path/to/timeupdate.bash # For 15-minute interval: */15 * * * * /path/to/timeupdate.bash - Make the update script executable:
[DEFAULT]
image_style = black
interval = 1m
output_dir = src/images/intervals1m/blackGreenOverlay
mask_dir = src/images/masks
overlay_dir = src/images/overlays
RedDot = 1
[LOCATION]
x = 631
y = 857
mode = black
[BLACK_GLOBE]
center_x = 960
center_y = 960
radius = 900
width = 1920
height = 1920
[XKCD_GLOBE]
center_x = 480
center_y = 480
radius = 450
width = 960
height = 960
- image_style: The style of images to use for the clock (
blackorxkcd). - interval: The interval for background updates (
1mor15m). - output_dir: Where generated frames are saved.
- mask_dir: Where alpha masks are stored.
- overlay_dir: Where overlay images are stored.
- RedDot: 1 to enable the red dot, 0 to disable.
- [LOCATION]: Your picked coordinates and style.
- [BLACK_GLOBE]/[XKCD_GLOBE]: Globe measurement data for accurate dot placement.
- Make sure all dependencies are installed (see above).
- If the background is not updating:
- Make sure
fehis installed - Check if the script is executable
- Verify your display is set correctly (e.g.,
DISPLAY=:0) - Check cron logs:
grep CRON /var/log/syslog - For Black Mode: Check systemd user service status:
systemctl --user status randall-clock-setup.service - For Black Mode: Check service logs:
journalctl --user -u randall-clock-setup.service - Check the update log:
tail -f /tmp/randall-clock/update_background.log
- Make sure
- If the background doesn't set on reboot/login:
- Verify the systemd user service is enabled:
systemctl --user is-enabled randall-clock-setup.service - Ensure the service runs after login:
systemctl --user start randall-clock-setup.service - Check that X display is available when the service runs
- Verify the systemd user service is enabled:
- If you have issues with the red dot or image generation, check the output directories and rerun the relevant scripts with overwrite enabled.
- XKCD "Now" clock: xkcd.com/1335
- Explanation: explainxkcd.com/1335
- Black globe version and batch image processing: Fred Weinhaus's ImageMagick scripts
This mode displays a black background with a green overlay showing the current time. The clock is viewed from the south pole and uses a 24-hour dial. The time display is calibrated with a fixed offset to ensure correct time alignment regardless of installation time.
Run the installation script:
./install_blackmode.shThis will:
- Check and install dependencies
- Prompt for update interval (how often the clock updates, in minutes)
- Prompt for location (to place the red dot on the globe)
- Generate the base globe image with the red dot
- Set up a cron job for periodic background updates
- Set up a systemd user service to run the background update at login
- Set the initial desktop background
For automated or non-interactive installation, you can use command-line arguments:
./install_blackmode.sh -i 5 -d sOptions:
-i interval- Update interval in minutes (1-60, e.g.,-i 5for 5-minute updates)-d dot_option- Red dot option:sto skip (use previous location from config.ini) orpto pick location interactively-h- Show help message
Examples:
# Interactive installation
./install_blackmode.sh
# Non-interactive: 5-minute updates, skip location picker
./install_blackmode.sh -i 5 -d s
# Non-interactive: 3-minute updates, pick new location
./install_blackmode.sh -i 3 -d p
# Show help
./install_blackmode.sh -hThe installation script automatically sets up a systemd user service (randall-clock-setup.service) that runs update_background.sh when you log in. This ensures:
- The background is set correctly after reboot/login
- X display is available (systemd service runs after graphical-session.target)
- The clock starts correctly on each login
The service is enabled automatically during installation. To manually check its status:
systemctl --user status randall-clock-setup.serviceTo disable it:
systemctl --user disable randall-clock-setup.serviceThe installation script also sets up a cron job that runs update_background.sh at your specified interval (e.g., every 5 minutes). This keeps the clock display current throughout your session.
To view your cron jobs:
crontab -lThe black mode globe is generated in two phases:
-
Installation Phase
During installation (viainstall_blackmode.sh), a base globe image is created with the red dot already placed on it. This is done using the--create-baseflag along with the--dot-xand--dot-ycoordinates. The resulting image is saved asbase_globe_with_dot.png. -
Update Phase
During updates (viaupdate_background.sh), the pre-createdbase_globe_with_dot.pngis used as the base image. Since the red dot is already part of the base image, the update process does not add a new dot. Therefore, the update script setsuse_red_dottoFalse, anddot_xanddot_yareNone. The workflow is as follows:- Installation: Create base globe with red dot → save as
base_globe_with_dot.png - Updates: Use
base_globe_with_dot.png→ rotate it → update background
- Installation: Create base globe with red dot → save as


