Desktop Background Switcher for i3wm

I wanted rotating background images on my desktop in i3wm (a great tiling window manager) and had trouble configuring some of the other options, so I wrote this script:


# Put this file at `~/bin/desktop_background_switcher`
# and `chmod +x ~/bin/desktop_background_switcher`

# Load a directory of image filenames. Change the path to match your system.

# Choose a random picture

# Change desktop background
feh --bg-fill "$CURRENT_PIC"

# Notify the user
notify-send -i "$CURRENT_PIC" 'Desktop Changed' $(basename -- "$CURRENT_PIC")

Set it to switch automatically by typing crontab -e and entering the following information:


# Switches the desktop background every 20 minutes
*/20 * * * * $HOME/bin/desktop_background_switcher

# Or for every hour
# 0 * * * * $HOME/bin/desktop_background_switcher

Pexels is a good site for finding images. I try to put a mix of images there that get me to think about what life is like in various places around the world.