Hisfantor's Blog

random desktop wallpaper

Dependencies:

Setup:

first off the settings file of wpr(.config/wallpaper-reddit/wallpaper-reddit.conf):

[Options]
    subs = earthporn,spaceporn,cyberpunk,digitalpainting,wallpapers,alternativeart
    minwidth = 1920
    minheight = 1080
    maxlinks = 20
    resize = True
    random = True
[Startup]
    attempts = 0
    interval = 0
[Save]
    directory = ~/Pictures/Wallpaper-reddit

next the script(.config/i3/wpr.sh):

#!/bin/bash
rm ~/Pictures/Wallpaper-reddit/wallpaper0.jpg      
wallpaper-reddit --random
wallpaper-reddit --save
feh --bg-scale /home/hisfantor/Pictures/Wallpaper-reddit/wallpaper0.jpg

and implement in i3wm(.config/i3/config):

exec_always --no-startup-id ~/.config/i3/wpr.sh

and just for fun a bash alias(.bash_aliases):

alias wpr='~/.config/i3/wpr.sh'

Explanation:

  1. startup of wpr is set off because i3 calls it every time it restarts
  2. the script deletes the last image which is called wallpaper0.jpg by wpr
  3. than it downloads the first best image from one of the subs
  4. it saves/downloads the image, which will be wallpaper0.jpg again
  5. feh sets the new image (location is defined in the wpr config)
  6. last i3 just starts the script whenever it starts or reloads($mod+r)
  7. a bash alias if I want to load an other image without reloading i3(consider it needs some seconds to download so don’t spam it, otherwise wpr will download multiple images and name them wallpaper1, wallpaper2, …)