yet another random wallpaper script

8 05 2010

Yea, everyone has a random wallpaper script. I especially like the ones where the guys sift through a couple of text files to get a wallpaper selected. I’m always a big fan of doing more work than is needed. Do I really need to use sarcasm tags for you guys???
Well anyways, this script uses ls | sort- R | head -1 to get a random image at logon. That’s right guys, you don’t have to muck around with any random command I use feh to set the image also. You could easily modify this script for swapping out walls at an interval and to use your preferred wallpaper setter.
Well, here is my incarnation.
————-
#!/bin/bash
## Description: Sets a random wallpaper from a list generated by ls in the wallpaper directory. Uses feh to set wallpaper.

wall_dir=”/home/m4x/Pictures/walls/”
random_wall=`ls $wall_dir | sort -R | head -1`
/usr/bin/feh –bg-scale $wall_dir$random_wall
# end of script

And one modified to swap walls every 30 minutes and use a text file.
————-
#!/bin/bash
## Description: Sets a random wallpaper from a list generated by ls in the wallpaper directory. Uses feh to set wallpaper. Changes every 30 minutes.

wall_dir=”/home/m4x/Pictures/walls/”
wall_list=”walls”
while :;do
random_wall=`cat $wall_dir$wall_list | sort -R | head -1`
/usr/bin/feh –bg-scale $wall_dir$random_wall
sleep 30m
done
# end of script

How do I use these??
Well, just add it to your user’s startup script or make a desktop file in ~/.config/autostart .


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.