Skip to content

Instantly share code, notes, and snippets.

@nine1one
Created January 23, 2026 09:41
Show Gist options
  • Select an option

  • Save nine1one/b22ff9ec9a36cfeb173f8220a4e02759 to your computer and use it in GitHub Desktop.

Select an option

Save nine1one/b22ff9ec9a36cfeb173f8220a4e02759 to your computer and use it in GitHub Desktop.
A simple, reliable Bash script that gives you time-of-day dynamic wallpapers on XFCE.

πŸ–ΌοΈ XFCE Dynamic Wallpaper Script (Time-Based)

πŸ“ Example wallpaper layout

~/Pictures/wallpapers/
β”œβ”€β”€ night.jpg
β”œβ”€β”€ morning.jpg
β”œβ”€β”€ noon.jpg
└── evening.jpg

You can name them whatever you want β€” just update the script.


πŸ“œ Script: xfce-dynamic-wallpaper.sh

#!/usr/bin/env bash

# --- CONFIG ---
WALLPAPER_DIR="$HOME/Pictures/wallpapers"

NIGHT="$WALLPAPER_DIR/night.jpg"
MORNING="$WALLPAPER_DIR/morning.jpg"
NOON="$WALLPAPER_DIR/noon.jpg"
EVENING="$WALLPAPER_DIR/evening.jpg"

# --- GET CURRENT HOUR ---
HOUR=$(date +%H)

# --- PICK WALLPAPER ---
if (( HOUR < 6 )); then
    WP="$NIGHT"
elif (( HOUR < 12 )); then
    WP="$MORNING"
elif (( HOUR < 17 )); then
    WP="$NOON"
elif (( HOUR < 20 )); then
    WP="$EVENING"
else
    WP="$NIGHT"
fi

# --- APPLY WALLPAPER TO ALL MONITORS ---
for path in $(xfconf-query -c xfce4-desktop -l | grep last-image); do
    xfconf-query -c xfce4-desktop -p "$path" -s "$WP"
done

πŸ”§ Setup

1️⃣ Make it executable

chmod +x xfce-dynamic-wallpaper.sh

2️⃣ Test it

./xfce-dynamic-wallpaper.sh

Wallpaper should change immediately.


⏰ Run it automatically (recommended)

Option A: Cron (simple)

Run every 10 minutes:

crontab -e

Add:

*/10 * * * * DISPLAY=:0 $HOME/xfce-dynamic-wallpaper.sh

Option B: XFCE Autostart

  • Settings β†’ Session and Startup β†’ Application Autostart
  • Add:
/home/youruser/xfce-dynamic-wallpaper.sh

🧠 Notes

  • Works on XFCE 4.14+
  • Supports multi-monitor
  • No feh, no GNOME, no hacks
  • You can add more time ranges or wallpapers easily

To Do:

  • πŸŒ… smooth transitions (fake fades)
  • 🌍 per-monitor wallpapers
  • πŸ“… exact sunrise/sunset switching
  • πŸ” GNOME XML β†’ XFCE conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment