Shuffling Wallpaper

| 3 TrackBacks
English: PNG transparency demonstration 24bit ...
I was looking into getting a little more random for my wallpaper and decided to write a quickie little commandline to get a couple new random pictures from my wallpaper directory. Looking at how the conkyPhotoRandom script from conky-colors does it, I came up with:

$ find /home/jdarnold/data/wallpapers -type f \( -name "*.jpg" -or -name "*.png" -or  -name "*.JPG" \) -print0 | shuf -z -n2 |xargs -0 feh --bg-scale

The cool part of this is the shuf command, which I didn't know about (or, just as likely, knew but forgot about). So this feeds a list of files from my wallpaper folder and randomly chooses two of them. I use 2 because I have 2 monitors, each displaying 1920x1080 and the 'feh' command takes two files and scales them for my background. Maybe I'll just set this as an alias and do it whenever I think of it.

Edited: Of course, you have to take into account spaces in the filenames. So I had to add the various options that use \0 as a line delimiter, rather than \n. In this case, -print0 tells find to end each line with a \0, -z tells shuf the lines end in \0, as does the -0 option for xargs.

shuf(1): make random permutations - Linux man page

Enhanced by Zemanta

3 TrackBacks

TrackBack URL:

????? ????? dalston from ????? ????? dalston on October 31, 2014 1:01 PM

Western design meets all Usa girlthat's a fabulous combination i cannot wait to wear. Read More

????? ????? ??? from ????? ????? ??? on November 7, 2014 12:57 PM

American design meets all Usa girlthat's a fabulous combination i cannot wait to wear. Read More

Very adept often bet Aion, Tera, And i am actually using extremely daydream 14. Patient receving desperate prophecy that many board on the net computer poker business by definitely dethrone warcraft. Every one of the failed to complete. Thought to be t... Read More

About this Entry

This page contains a single entry by Jonathan published on October 10, 2012 11:16 AM.

Off To Goomwwm Land was the previous entry in this blog.

chvt magic is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.