+
+
+wallpaper_dir = home .. "/media/photos/gallery.donarmstrong.com/"
+if (not file_exists(wallpaper_dir)) then
+ wallpaper_dir = "/usr/share/awesome/themes/default/background.png"
+end
+
+wallpaper_cmd = "find " .. wallpaper_dir ..
+ " -xtype f \\( -iname '*.jpg' -o -iname '*.png' \\) " ..
+ " -not -name '.*' -print0 | shuf -n" .. screen.count() .. " -z | xargs -0 feh --bg-max"
+
+-- set up the wallpaper timer
+wallpaper_timer = timer({ timeout = 0 })
+wallpaper_timer:add_signal("timeout",
+ function()
+ -- tell awsetbg to randomly choose a wallpaper from your wallpaper directory
+ os.execute(wallpaper_cmd)
+ -- stop the timer (we don't need multiple instances running at the same time)
+ wallpaper_timer:stop()
+
+ -- define the interval in which the next wallpaper change should occur in seconds
+ -- (in this case anytime between 10 and 20 minutes)
+ --restart the timer
+ wallpaper_timer.timeout = math.random(600,1200)
+ wallpaper_timer:start()
+ end
+)
+wallpaper_timer:start();