Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2014-08-18 10:52:12

Registered: 2014-07-29
Posts: 20

simpler rotating wallpapers script

just fooling around with google, python and feh, ended up with this:

pick a random file from a folder with images (as far as I know it's recursive, but I have only one level, so I didn't test it).


import os, random

working_directory = '/home/hrnn/wallpapers/'
new_wallpaper = random.choice(os.listdir('/home/hrnn/wallpapers'))

os.system('DISPLAY=:0 feh --bg-scale ' + working_directory + new_wallpaper )

the "DISPLAY=:0" bit is necessary as cron runs in a lower level and doesn't care about X, so it must be explicitly stated in order for feh to do what I'm asking. so said google, at least.

saved simply as rotatewallpaper (no extension)

and the crontab, every ten minutes

*/10 * * * * /home/hrnn/rotatewallpaper  


Last edited by hrnn187 (2014-08-18 10:53:39)


Help fund CrunchBang, donate to the project!

#2 2014-09-13 01:06:32

From: Dayton, OH
Registered: 2012-02-10
Posts: 49

Re: simpler rotating wallpapers script

Does it cause your monitor to flicker when changing wallpapers?


Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo